CRichEditCtx.TextLengthmethod
Retrieves the length of all text in a rich edit control.
Syntax
FUNCTION TextLength () AS LONG
Return value
The return value is the length of the text in characters, not including the terminating null character.
Description
Retrieves the length of all text in a rich edit control.
Remarks
When the GetTextLength method is called, the DefWindowProc function returns the length, in characters, of the text. Under certain conditions, the DefWindowProc function returns a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the system allowing for the possible existence of double-byte character set (DBCS) characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode.
To retrieve the text, you can also use the AfxGetWindowText function, the WM_GETTEXT message, or the Windows API GetWindowTextW function.
Reference
- Defined in AfxNova/CRichEditCtx.inc:1790
- Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
- Topic: CRichEditCtx Class