Button Default Message Processing

The window procedure for the predefined button control window class processes defaults for all messages that the button control procedure does not process. When the button control procedure returns FALSE for any message, the predefined window procedure checks the messages and performs the default actions described in the following table.

Message Default action
BM_CLICK Sends the button a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and sends the parent window a BN_CLICKED notification message.
BM_GETCHECK Returns the check state of the button.
BM_GETSTATE Returns the current check state, push state, and focus state of the button.
BM_SETCHECK Sets the check state for all styles of radio buttons and check boxes. If the wParam parameter is greater than zero for radio buttons, the button is given the WS_TABSTOP style.
BM_SETSTATE Sets the push state of the button. For owner-drawn buttons, a WM_DRAWITEM message is sent to the parent window if the state of the button has changed.
BM_SETSTYLE Sets the button style. If the low-order word of the lParam parameter is TRUE, the button is redrawn.
WM_CHAR Changes the check state of a check box when the user presses the space bar.
WM_ENABLE Paints the button.
WM_ERASEBKGND Erases the background for owner-drawn buttons. The backgrounds of other buttons are erased as part of the WM_PAINT and WM_ENABLE processing.
WM_GETFONT Returns a handle of the current font.
WM_KEYDOWN Pushes the button, if the user presses the SPACEBAR.
WM_KEYUP Releases the mouse capture for all cases except the TAB key.
WM_KILLFOCUS Removes the focus rectangle from a button. For push buttons and default push buttons, the focus rectangle is invalidated. If the button has the mouse capture, the capture is released, the button is not clicked, and any push state is removed.
WM_LBUTTONDBLCLK Sends a BN_DBLCLK notification message to the parent window for radio buttons and owner-drawn buttons. For other buttons, a double-click is processed as a WM_LBUTTONDOWN message.
WM_LBUTTONDOWN Highlights the button if the position of the mouse cursor is within the button's client rectangle.
WM_LBUTTONUP Releases the mouse capture if the button has the mouse capture.
WM_PAINT Draws the button according to its style and current state.
WM_SETFOCUS Draws a focus rectangle on the button getting the focus. For radio buttons and automatic radio buttons, the parent window is sent a BN_CLICKED notification message.
WM_SETFONT Sets a new font and, optionally, updates the window.
WM_SETTEXT Sets the text of the button. In the case of a group box, the message paints over the preexisting text before repainting the group box with the new text.
WM_SYSKEYUP Releases the mouse capture for all cases except the TAB key.