Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
hi all,
how can i retrieve whether a check box is checked or not in Visual C++? what method of mfc should i use?
thanx a lot

Hi!
Your Check Box must have an associated variable in the class of your window. If not, create it in the MFC Class Wizzard, under the tab "member variables".
If you choose to create a boolean variable, you can then get the value of the check box by reading this bool variable, after having called UpdateData(TRUE).
If you choose to create a control variable (CButton), you can call CButton::GetState(), and match the return value. Mask this return value with 0x0003. if the result of (ret_value & 0x0003) is zero, the box is not checked. If it is 1, the box is checked. A 2 means undeterminate, but you may not need that.
All this nice information can be found in MSDN.
Good luck!

![]() |
c - plus infinity & v...
|
combining pic files into ...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |