Share via


GetWindowTextLength (Compact 2013)

3/28/2014

This function retrieves the length, in characters, of the specified window's title bar text - if the window has a title bar. If the specified window is a control, the function retrieves the length of the text within the control.

Syntax

int GetWindowTextLength( 
  HWND hWnd 
); 

Parameters

  • hWnd
    [in] Handle to the window or control.

Return Value

The length, in characters, of the text indicates success. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section. Zero indicates that the window has no text. To get extended error information, call GetLastError.

Remarks

GetWindowTextLength causes a WM_GETTEXTLENGTH message to be sent to the specified window or control.

Note

If the specified window is a cross process window and it does not handle messages, the call will be blocked indefinitely.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

Requirements

Header

winuser.h

See Also

Reference

Window Functions
CB_GETLBTEXT
GetWindowText
LB_GETTEXT
SetWindowText
WM_GETTEXT
WM_GETTEXTLENGTH