Solved

BS_AUTOCHECKBOX

Posted on 1998-04-16
2
919 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
Comment Utility
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
Comment Utility
Once again this service is great.

WxW's answer was very prompt and helpful.

Thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

743 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now