Solved

BS_AUTOCHECKBOX

Posted on 1998-04-16
2
962 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

634 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