Computing.Net > Forums > Programming > check box value & visual C++

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

check box value & visual C++

Reply to Message Icon

Name: Zeynep
Date: October 18, 2002 at 01:43:41 Pacific
OS: Win 2k Server
CPU/Ram: P4 1.4 GHz 256 MB RAM
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: Gauthier
Date: October 18, 2002 at 06:03:45 Pacific
Reply:

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!


0
Reply to Message Icon

Related Posts

See More


c - plus infinity & v... combining pic files into ...



Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: check box value & visual C++

Resource Problem Visual C++ www.computing.net/answers/programming/resource-problem-visual-c/9784.html

Linux Visual C++ www.computing.net/answers/programming/linux-visual-c/2201.html

Visual C++ / MFC / Controls / Edit www.computing.net/answers/programming/visual-c-mfc-controls-edit-/9689.html