Solved

DoModal() problem

Posted on 1998-05-13
5
347 Views
Last Modified: 2013-11-20
I want to write a program: Dialog1 have a button (Show) and two edit box
to input x, y. When press Show, the other dialog (Dialog2) show something in
variables x, y.
Can I use DoModal() to diaplay Dialog2 . If can: How can I write something
to modal dialog.
If can not: Could you show me another way ?  

Thanks
0
Comment
Question by:nhcuong
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Blondie050798
ID: 1310333
Um...I sure this question is actually quite easy, but I didn't understand it...can you clarify the question again?

Do you have a dialog (Dialog1) which is displayed with DoModal(), and on it there are 2 edit boxes (x & y) and a button (Show).  When you press Show, another dialog box is displayed (Dialog2).  Apart from that, I'm a bit confused about the relationship that you require between the two dialogs...sorry I can't help anymore yet...let me have some more details...
0
 
LVL 8

Accepted Solution

by:
gelbert earned 0 total points
ID: 1310334
You have to use DoModal() to implement modal dialog. To get information into modal dialog which is up( after DoModal() call), it has to make a call to request information. You can pass in information into dialog after you created object but before call to DoModal()

CYourDlg dlg;
dlg.SetXY( x, y );
dlg.DoModal();

OR

CYourdlg::OnInitDialog()
{
   GetParent()->GetXY( &x, &y );
}
0
 

Author Comment

by:nhcuong
ID: 1310335
Hi gelbert,
But SetXY is not a member of CDialog.
Hi Blondie,
I only want Dialog2 can display data of Dialog1.

0
 

Author Comment

by:nhcuong
ID: 1310336
HI,
Could you tell me more! I can do nothing from the early advice .
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1310337
Derive your own class form CDialog and add SetXY/GetXY as a public member functions. There are only two ways to pass data into modal dialog.
First before it is up ( between construction and call to DoModal(), SetXY) and second is to request data from modal dialog (GetXY)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ShiftLeft challenge 21 76
Unix Command -- Challenging  question 7 86
How to convert MFC::CString to UTF8 wchar_t* 10 137
Excel file not created as expected 7 46
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

937 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

11 Experts available now in Live!

Get 1:1 Help Now