Help Center

CRichEdit.GetTextLengthExmethod

Calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control.

Windowsmethoddocumented

Syntax

FUNCTION GetTextLengthEx (BYVAL hRichEdit AS HWND, BYVAL lpgtex AS GETTEXTLENGTHEX PTR) AS LONG

Parameters

NameDescription
hRichEditThe handle of the rich edit control.
lpgtexPointer to a GETTEXTLENGTHEX structure that receives the text length information.

Return value

The message returns the number of characters in the edit control, depending on the setting of the flags in the GETTEXTLENGTHEX structure. If incompatible flags were set in the flags member, the message returns E_INVALIDARG.

Description

Calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control.

Remarks

This message is a fast and easy way to determine the number of characters in the Unicode version of the rich edit control. However, for a non-Unicode target code page you will potentially be converting to a combination of single-byte and double-byte characters.

Reference

  • Defined in AfxNova/CRichEdit.inc:701
  • Documented in Windows/WIndows Controls/CRichEdit Class.md
  • Topic: CRichEdit Class