Help Center

CTextRange2.CONSTRUCTORconstructor

Called when a class variable is created.

Windowsconstructordocumented

Syntax

DECLARE CONSTRUCTOR (BYVAL pTextRange2 AS ITextRange2 PTR, BYVAL fAddRef AS BOOLEAN = FALSE)

Parameters

NameDescription
pTextRange2An ITextRange2 interface pointer.
fAddRefOptional. TRUE to increment the reference count of the passed ITextRange2 interface pointer; otherwise, FALSE. Default is FALSE.

Return value

A pointer to the new instance of the class.

Description

Called when a CTextRange2 class variable is created.

Examples

SCOPE ' // Get the number of characters of the text in the Rich Edit control DIM numChars AS LONG = pRichEdit->TextLength ' // Get the 0-based range of all the text DIM pRange2 AS CTextRange2 = pRichEdit->Range2(0, numChars) ' // Get the text DIM dwsText AS CBDWSTRING = pRange2.GetText(tomUseCRLF) ' // The CTextRange2 class will be destroyed when the scope ends END SCOPE

' // Get the number of characters of the text in the Rich Edit control DIM numChars AS LONG = pRichEdit->TextLength ' // Get the 0-based range of all the text DIM pRange2 AS CTextRange2 PTR = NEW CTextRange2(pRichEdit->Range2(0, numChars)) ' // Get the text DIM dwsText AS DWSTRING = pRange2->GetText(tomUseCRLF) ' // Delete the range Delete pRange2

To use with the dotted syntax.

To use with the pointer syntax.

Reference

  • Defined in AfxNova/CTextRange2.inc:139
  • Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
  • Topic: CTextRange2 Class