Noob question

So I'm fairly new to using the windows API, along with my new IDE Visual studio. I've been messing around in the template and options to get a hang of things but I', getting hung up on checkboxes in dialogs.

I went to the resources, made a new dialog, and added in some checkboxes. What I wanted to do was have it so that if a checkbox was checked when the ok button was pressed, a message box would pop up saying that you've checked the checkbox.

The issue : I don't know how to get the checkbox state.

I know : When I make a call to the checkbox (IDC_CHECK1), it returns the ID number of the checkbox rather than its state. The checkbox is an auto tristate. The checkbox is part of a dialog (DIALOG2). The checkbox was made through the resources tab in microsoft visual studio 2012.

I don't know : Where the actual code is for the checkbox I made through the IDE. IF there is even normal code that was made when I made the checkbox. How to call the state of the checkbox through code.

I hope someone can explain a little about this to me, so I can understand and move on in trying to understand other aspects in the windows API and the MSV IDE.
LRESULT state = SendDlgItemMessage( (DialogHWND), IDC_CHECK1, BM_GETSTATE, 0, 0 );

'state' can be one of the result values in the second link.

BST_CHECKED, for instance, tells you the checkbox is checked.
Last edited on
Thanks for the info and resources!
For this very specific task you could also use IsDlgButtonChecked() function:
I can only think of that way of a slower way because:

MSDN wrote:
The IsDlgButtonChecked function sends a BM_GETCHECK message to the specified button control.

So it has more function calls and that makes it a bit slower.
Topic archived. No new replies allowed.