Computer Science Canada

CheckBox in Win32

Author:  deville75 [ Wed Mar 28, 2007 2:17 pm ]
Post subject:  CheckBox in Win32

I'm trying to use a checkbox, but I'm not sure how to check if the box has been checked or not. Can anyone here help me?

Author:  Andy [ Wed Mar 28, 2007 2:24 pm ]
Post subject:  Re: CheckBox in Win32

how are you implementing the checkbox? If you're using MFC, its quite easy. right click, and setaction or something.

Author:  deville75 [ Wed Mar 28, 2007 2:31 pm ]
Post subject:  Re: CheckBox in Win32

Andy @ Wed Mar 28, 2007 2:24 pm wrote:
how are you implementing the checkbox? If you're using MFC, its quite easy. right click, and setaction or something.


I'm using Win32. So I have a resource file that creates the checkbox and Now I just need to know whether it's being checked or not. I'm guessing it's some sort of message.. I'm not sure. I feel like I should know this but it's not coming to me.

Author:  deville75 [ Wed Mar 28, 2007 2:54 pm ]
Post subject:  Re: CheckBox in Win32

Ok I figured it out:

code:

if (SendMessage(dev3cb, BM_GETSTATE, 0, 0) == BST_CHECKED)
                                view = CreateDialog (hInst, MAKEINTRESOURCE(IDD_VIEW), hWndDlg, reinterpret_cast<DLGPROC>(DlgViewProc));


Basically
code:
SendMessage(dev3cb, BM_GETSTATE,0,0)
returns BST_CHECKED, BST_UNCHECKED, or some other values I'm not worried about.


: