Solved

BS_AUTOCHECKBOX

Posted on 1998-04-16
2
935 Views
Last Modified: 2008-02-01
I would like to get the AUTOCHECKBOX Button to perform one task when Checked and yet another when Unchecked.

The following peice of my program writes "on" to a result window when it is clicked on. I would like for it to write "off" to the same result window when it is clicked off.

I would appreciate any help.

Thanks
Randy

BEGIN_MESSAGE_MAP( CWindow, CFrameWnd )
      ON_BN_CLICKED(IDC_BUTTON2, HandleButton2)      

END_MESSAGE_MAP()

// Handle the r_cont button
void CWindow::HandleButton2()
{
         char x_dir[ ] = "on";
        SetDlgItemText(IDC_RESULT5,x_dir);
}

0
Comment
Question by:RandyG
2 Comments
 
LVL 6

Accepted Solution

by:
WxW earned 50 total points
ID: 1184341
In your function , you can use the ::SendMessage as follows :

int x = ::SendMessage(hWndControl,BM_GETCHECK,0,0);
if (x == 0)
{ // NOT checked code }
else
{ // Checked Code }


You must provide the handle of the control , and I do not know how MFC does it , OWL uses the HWindow member for the parent window , so you can use ::GetDlgItem(HWindow,Item_Id);
0
 

Author Comment

by:RandyG
ID: 1184342
Once again this service is great.

WxW's answer was very prompt and helpful.

Thanks
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question