Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

checkbox - change notification

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?

like image 995
Mike D Avatar asked Oct 09 '09 21:10

Mike D


2 Answers

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)

like image 169
Nick Dandoulakis Avatar answered Nov 19 '22 12:11

Nick Dandoulakis


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

like image 2
Martin v. Löwis Avatar answered Nov 19 '22 12:11

Martin v. Löwis