WM_CLEAR

2.x

WM_CLEAR
wParam = 0;     /* not used, must be zero */
lParam = 0L;    /* not used, must be zero */

An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, in the edit control.

Parameters

This message has no parameters.

Return Value

The return value is nonzero if this message is sent to an edit control or a combo box.

Comments

The deletion performed by the WM_CLEAR message can be undone by sending the edit control an EM_UNDO message.

To delete the current selection and place the deleted contents into the clipboard, use the WM_CUT message.

Example

This example sends an EM_SETSEL message to select the entire contents of an edit control. It then sends a WM_CLEAR message to delete the contents of the edit control.

SendDlgItemMessage(hdlg, ID_MYEDITCONTROL,
    EM_SETSEL, 0, MAKELONG(0, -1));
SendDlgItemMessage(hdlg, ID_MYEDITCONTROL,
    WM_CLEAR, 0, 0L);

See Also

EM_UNDO, WM_COPY, WM_CUT, WM_PASTE