Share via


WM_GETTEXT

This message is sent by an application to copy the text that corresponds to a window into a buffer provided by the caller.

WM_GETTEXT wParam = (WPARAM) cchTextMax; 
lParam = (LPARAM) lpszText;

Parameters

  • cchTextMax
    Specifies the maximum number of characters to be copied, including the terminating null character.
  • lpszText
    Long pointer to the buffer that is to receive the text.

Return Values

The return value is the number of characters copied.

  • Default Action
    The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied.

Remarks

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content 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 copy the text of an item in a list box, an application can use the LB_GETTEXT message.

When the WM_GETTEXT message is sent to a static control with the SS_ICON style, a handle to the icon will be returned in the first four bytes of the buffer pointed to by lpszText. This is true only if the WM_SETTEXT message has been used to set the icon.

In a rich edit control, if the text to be copied exceeds 64K, use either the message EM_STREAMOUT or EM_GETSELTEXT.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winuser.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DefWindowProc, GetWindowText, GetWindowTextLength, LB_GETTEXT, WM_GETTEXTLENGTH, WM_SETTEXT

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.