Help Center

CTextDocument2.CONSTRUCTORSconstructor

Called when a class variable is created.

Windowsconstructordoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

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

NameDescription
hRichEditHandle of the Rich Edit control.
pTextDocument2An ITextDocument2 interface pointer.
fAddRefOptional. 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