Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Control Library
Button
Messages
 BM_GETCHECK Message

  Switch on low bandwidth view
BM_GETCHECK Message

Gets the check state of a radio button or check box. You can send this message explicitly or use the Button_GetCheck macro.

Syntax

To send this message, call the SendMessage function as follows.
lResult = SendMessage(     // returns LRESULT in lResult
   (HWND) hWndControl,     // handle to destination control
   (UINT) BM_GETCHECK,     // message ID
   (WPARAM) wParam,     // = 0; not used, must be zero
   (LPARAM) lParam     // = 0; not used, must be zero
);

Parameters

wParam
Not used; must be zero.
lParam
Not used; must be zero.

Return Value

The return value from a button created with the BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or BS_3STATE style can be one of the following.

BST_CHECKEDButton is checked.
BST_INDETERMINATEButton is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
BST_UNCHECKEDButton is cleared

Remarks

If the button has a style other than those listed, the return value is zero.

Message Information

HeaderDeclared in Winuser.h, include Windows.h
Minimum operating systems Windows 95, Windows NT 3.1

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
BM_GETSTATE returns BST_UNCHECKED if the checkbox is hidden even if checked      Gideon7   |   Edit   |   Show History

Known Bug: If the user checks the box and later hides it (e.g., calling ShowWindow(GetDlgItem(hwnd,idCheck),SW_HIDE) in response to a dialog mode change), BM_GETSTATE will wrongly return BST_UNCHECKED even though the box is still checked.

Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker