BM_GETSTATE
wParam = 0; /* not used, must be zero */
lParam = 0L; /* not used, must be zero */
An application sends a BM_GETSTATE message to retrieve the state of a button.
This message has no parameters.
The return value specifies the current state of the button. You can use the following masks to extract information about the state:
Mask | Description |
0x0003 | Specifies the check state (radio buttons and check boxes only). A value of 0 indicates the button is unchecked. A value of 1 indicates the button is checked. A radio button is checked when it contains a dot; a check box is checked when it contains an X. A value of 2 indicates the check state is indeterminate (3-state check boxes only). The state of a 3-state check box is indeterminate when it is grayed. |
0x0004 | Specifies the highlight state. A nonzero value indicates that the button is highlighted. A button is highlighted when the user presses and holds the left mouse button. The highlighting is removed when the user releases the mouse button. |
0x0008 | Specifies the focus state. A nonzero value indicates that the button has the focus. |
This example determines whether a button currently has the focus:
#define BFFOCUS 0x0008
DWORD dwResult;
dwResult = SendDlgItemMessage(hdlg, ID_MYBUTTON, BM_GETSTATE, 0, 0L);
if (dwResult & BFFOCUS)
/* button has the focus */