MSDN Home >  MSDN Library >  User Interface Design and Development >  Windows Controls >  Individual Control Information >  Rich Edit Controls > 

EM_GETTEXTLENGTHEX Message


The EM_GETTEXTLENGTHEX message calculates text length in various ways. It is usually called before creating a buffer to receive the text from the control.

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage(     // returns LRESULT in lResult
   (HWND) hWndControl,     // handle to destination control
   (UINT) EM_GETTEXTLENGTHEX,     // message ID
   (WPARAM) wParam,     // = (WPARAM) () wParam;
   (LPARAM) lParam     // = (LPARAM) () lParam;
);

Parameters

wParam
Pointer to a GETTEXTLENGTHEX structure that receives the text length information.
lParam
This parameter is not used; it must be zero.

Return Value

The message returns the number of TCHARs 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 .


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.

Message Information

HeaderDeclared in Richedit.h
Minimum operating systems Windows 95 with Rich Edit 2.0 , Windows 98, Windows NT 4.0

See Also

Rich Edit Controls, GETTEXTLENGTHEX
 Contact Us   |  E-Mail this Page   |  MSDN Flash Newsletter
 c 2002 Microsoft Corporation. All rights reserved.   Terms of Use  Privacy Statement   Accessibility