WM_GETTEXTLENGTH
wParam = 0; /* not used, must be zero */
lParam = 0L; /* not used, must be zero */
An application sends a WM_GETTEXTLENGTH message to determine the length, in bytes, of the text associated with a window. The length does not include the terminating null character.
This message has no parameters.
The return value is a word specifying the length, in bytes, of the text.
For an edit control, the text to be copied is the contents of the edit control. For a combo box, the text is the contents of the edit-control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To determine the length of an item in a list box, an application can use the LB_GETTEXTLEN message.
This example enables the push button in a dialog box if the user has entered text in an edit control in the dialog box:
case ID_MYEDITCONTROL:
if (HIWORD(lParam) == EN_CHANGE)
EnableWindow(GetDlgItem(hdlg, IDOK),
(BOOL) SendMessage(LOWORD(lParam),
WM_GETTEXTLENGTH, 0, 0L));
return TRUE;