CRichEditCtx.GetTextRangemethod
Retrieves a specified range of characters from a rich edit control.
Syntax
FUNCTION GetTextRange (BYREF trg AS .TEXTRANGEW) AS DWORD
FUNCTION GetTextRange (BYVAL cpMin AS LONG = 0, BYVAL cpMax AS LONG = -1) AS DWSTRING
Parameters
| Name | Description | |
|---|---|---|
trg | A TEXTRANGEW structure that specifies the range of characters to retrieve and a buffer to copy the characters to. | |
cpMin | Character position index immediately preceding the first character in the range. | |
cpMax | Character position immediately following the last character in the range. If the cpMin and cpMax members are equal, the range is empty. The range includes everything if cpMin is 0 and cpMax is –1. |
Return value
The first overloaded method returns the number of characters copied, not including the terminating null character.
The second overloaded method returns the retrieved text.
Description
Overloaded method that retrieves a specified range of characters from a rich edit control.
Examples
DIM cbLen AS LONG = pRichEdit.GetTextLEngth DIM wstrText AS DWSTRING = WSPACE(cbLen + 1) DIM trg AS TEXTRANGEW trg.chrg.cpMin = 0 trg.chrg.cpMax = -1 trg.lpstrText = wstrtext pRichEdit.GetTextRange(trg) AfxMsg wstrtext
DIM dws AS DWSTRING = pRichEdit.GetTextRange AfxMsg dws
DIM sws AS DWSTRING = pRichEdit.GetTextRange(5, 15) AfxMsg sws
Retrieve all the text using the first overloaded method:
Retrieve all the text using the second overloaded method: Retrieve a range of text.
Reference
- Defined in AfxNova/CRichEditCtx.inc:3123
- Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
- Topic: CRichEditCtx Class