Computing.Net > Forums > Programming > Few questions about MFC programming

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Few questions about MFC programming

Reply to Message Icon

Name: Jeff
Date: December 11, 2003 at 08:30:47 Pacific
OS: WinME
CPU/Ram: 128Mb 733MHz
Comment:

I have a few questions, the first is how can i transfer data from 1 dialog to another EG i hav 2 buttons on a dialog, click "button 1" and another dlg pops up. In that dlg there is a check box control, i click the check the box, when u hit ok on the dlg it closes and u r returned to the first dlg. Click on "button 2" on the first dlg and a messagebox will appear sayin, u checked the checkbox. I can make this happen all on 1 dlg but i don't no how to check if the control was clicked or not. Any suggestions

The other thing is, how can i make an MFC app without the MFC dll's, either by not linking the program to the dll's or to include the dll's in the EXE some how
Thanks a bunch



Sponsored Link
Ads by Google

Response Number 1
Name: Dr. Nick
Date: December 11, 2003 at 17:21:40 Pacific
Reply:

I believe you do it like this:

Say in the class of your second dialog, the one with the checkbox, you have a variable that relates to the status of the checkbox.

In the class for the first dialog, you should have a variable for the second dialog. You use this variable to call the DoModal() function of the second dialog. So, to get the value of the variable related to the status of that checkbox, you use the same variable. Kinda like this:

=========================================================================

//Assign a new variable to the second dialog's class
CMyDialog m_dDialog2;

//Call the second dialog's domodal function to display the box
m_dDialog2.DoModal();

//User checks or unchecks a checkbox, attached to the variable m_bCheckBox

//User returns to calling dialog by clicking OK

//Back to the original dialog, so get value of m_bCheckBox
if (m_dDialog2.m_bCheckBox == 1)
  MessageBox("The box was checked.");
else
  MessageBox("The box was not checked");


==========================================================================

I think that should do it. You should be able to access any member of another dialog class by using a varialbe whos type is that class.


0
Reply to Message Icon

Related Posts

See More


WebBrowser control - VB6 About ADO..?



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: Few questions about MFC programming

Question Creating GUIs for programs www.computing.net/answers/programming/question-creating-guis-for-programs/5972.html

Game programing question www.computing.net/answers/programming/game-programing-question/4262.html

questions: demand for programmers www.computing.net/answers/programming/questions-demand-for-programmers/3361.html