WM_GETTEXT

An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.

Parameters

wParam

Specifies the maximum number of characters to be copied, including the null-terminating character.

lParam

Points to the buffer that is to receive the text.

Return Value

The return value is the number of characters copied. It is CB_ERR if the message is sent to a combo box that has no edit control.

Comments

For an edit control, the text to be copied is the content of the edit control. For a combo box control, the text is the content of the edit control (or static text) portion of the combo box. For a button control, the text is the button name. For other windows, the text is the window caption. To copy the text of an item in a list box, an application can use the LB_GETTEXT message.

The WM_GETTEXT message may be used as either a wide-character message (where text arguments must use Unicode) or an ANSI message (where text arguments must use characters from the Windows 3.x character set installed).

See Also

LB_GETTEXT, WM_GETTEXTLENGTH