views:

179

answers:

2

What notification code is sent with the wm_command message to the dialog box procedure when a check box changes state?

And more importantly, where would I look in the msdn to find the notification codes for various controls?

+1  A: 

It's BN_CLICKED. The bottom of the page links to the button messages.

Martin v. Löwis
Thanks, I thought I had tried that but made a () mistake.What do you mean by 'The bottom of the page links to the button messages'? What page? I see if I knew enough to look up BN_CLICKED, I could have gotten to 'Button Messages'. For example, if I want to find out about list box messages, where would I start?
Mike D
A: 

Note that Check boxes and Radio buttons are Buttons. So they send click and double click messages, BN_CLICKED and BN_DOUBLECLICKED.

If you use MFC, then you can examine the check state with CButton::GetCheck method. Otherwise you send the BM_GETCHECK message to the control: SendMessage(button_handle, BM_GETCHECK, 0, 0);

SendMessage can return

  • BST_CHECKED Button is checked.
  • BST_INDETERMINATE Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
  • BST_UNCHECKED Button is cleared
  • If the button has a style other than those listed, the return value is zero.

If you use the Visual Studio, the easiest way to get a list of events/messages a control can send is to go to Resource/Design view, right click a control and select Events.

For a list of common controls see: Control Library
(in the page you'll see a popup menu with the controls if you hover the cursor on the Control Library link)

Nick D