CTextDocument2.CONSTRUCTORSconstructor
Called when a class variable is created.
Syntax
DECLARE CONSTRUCTOR
DECLARE CONSTRUCTOR (BYVAL hRichEdit AS HWND)
DECLARE CONSTRUCTOR (BYVAL pTextDocument2 AS ITextDocument2 PTR, BYVAL fAddRef AS BOOLEAN = FALSE)
CONSTRUCTOR CTextDocument2 (BYVAL hRichEdit AS HWND)
CONSTRUCTOR CTextDocument2 (BYVAL pTextDocument2 AS ITextDocument2 PTR, BYVAL fAddRef AS BOOLEAN = FALSE)
Parameters
| Name | Description | |
|---|---|---|
hRichEdit | Handle of the Rich Edit control. | |
pTextDocument2 | An ITextDocument2 interface pointer. | |
fAddRef | Optional. TRUE to increment the reference count of the passed ITextDocument2 interface pointer; otherwise, FALSE. Default is FALSE. |
Return value
A pointer to the new instance of the class.
Description
Called when a CTextDocument2 class variable is created.
Examples
DIM pCTextDocument2 AS CTextDocument2 pCTextDocument2.Attach(pTextDocument2)
SCOPE ' // Create a new instance of the CTextDocument2 class DIM pTextDocument2 AS CTextDocument2 = hRichEdit ' // Get the number of characters of the text in the Rich Edit control DIM numChars AS LONG = RichEdit_GetTextLength(hRichEdit) ' // Get the 0-based range of all the text DIM pCRange2 AS CTextRange2 = pCTextDoc.Range2(0, numChars) ' // Get the text DIM dwsText AS DWSTRING = pCRange2.GetText2(0) ' // The CTextDocument2 class and the CTextRange2 class will be destroyed when the scope ends END SCOPE
' // Create a new instance of the CTextDocument2 class DIM pCTextDocument2 AS CTextDocument2 PTR = NEW CTextDocument2(hRichEdit) ' // Get the number of characters of the text in the Rich Edit control DIM numChars AS LONG = RichEdit_GetTextLength(hRichEdit) ' // Get the 0-based range of all the text DIM pCRange2 AS CTextRange2 = pCTextDoc->Range2(0, numChars) ' // Get the text DIM dwsText AS DWSTRING = pCRange2->GetText2(0) ' // Delete the range Delete pCRange2 ' // Delete the class Delete pCTextDocument2
To use with the dotted syntax.
To use with the pointer syntax.
Reference
- Documented in Windows/WIndows Controls/RichEdit/CTextDocument2 Class.md
- Topic: CTextDocument2 Class