• Advertisement
Sign in to follow this  

checkboxes and win32api

This topic is 4333 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

sorry if this is newbish but... how would you retrieve the state of a check box/radiobutton in a modal dialog box? i cant seem to get docs in msdn to do this with GetDlgItemInt, etc. any help is appreciated

Share this post


Link to post
Share on other sites
Advertisement
Send the control a BM_GETCHECK message. It should work for both checkboxes and radio buttons.

Or if you want to be cool include windowsx.h and use the Button_GetCheck macro.

Share this post


Link to post
Share on other sites
You can send the message BM_GETCHECK to check the state of checkboxes and radiobuttons.


MSDN: BM_GETCHECK

Use it with a dialog like:

if(SendMessage(GetDlgItem(hDlg, IDC_CHECK1), BM_GETCHECK, 0, 0) == BST_CHECKED)
{
// Is checked
}
else
{
// Is unchecked
}



Hope that helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement