Solved

easy...dialogs

Posted on 2000-02-14
7
208 Views
Last Modified: 2012-05-04
I want to be able to have a button that loads a new dialog and hides the current.  I also want to have a button on the second dialog which will unload itself and load the first dialog again.  Does this make sense?  I am new to VC++ and could use as much code as possible.  Leave a comment if you need clarification on any of this.
0
Comment
Question by:neymeyer
7 Comments
 
LVL 6

Expert Comment

by:WxW
ID: 2520400
So is that difficult ?

The WM_COMMAND handler for each window should do
1st DestroyWindow(CurrentDialog)
2nd CreateDialog(prgInstance,"DIALOG_OTHER",0,DialogProc);

3rd If you don't know the Windows API and/or you use a VC++ class , you need either a VC++ expert ( and I am not ! ) , or use the above code modified in your message handler .

0
 
LVL 1

Expert Comment

by:jwilcox
ID: 2520524
Since you want to keep the first dialog alive, you could probably also just set the first dialog as hidden I haven't worked in VC++ in about 2-3 months but I believe its dialog.visible(FALSE);

That shouldn't cause problems, even if they are modal dialog boxes, but I could be wrong.
0
 

Expert Comment

by:malamontagne
ID: 2521101
You simply have to create the second windows with the Create function when the user click on your button and then call ShowWindow() on the first window with the hide option. After that, when the user click the button on the second window, you hide this window the same way as the first one and the call ShowWindow() with the Show option.

Naturally, you will need to pass the handler of the windows to each other to have the access that you need.
0
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.

 
LVL 5

Expert Comment

by:Wyn
ID: 2521108
Add a button to the first.

void CDialog1::OnButton()
{
 CDialog2 dlg2;
 ShowWindow(SW_HIDE);  
 if (dlg2.DoModal()==IDOK)
 {
   
//some things here,like
 ShowWindow(SW_SHOW);  

 }
}

0
 

Author Comment

by:neymeyer
ID: 2523078
Wyn,
I have this part done.  What I want to be able to do is re-call the first dialog from a button click on the second dialog.  The real problem is that I can't just call the first one the same way as the second because it is created with the CDialogDlg class that is automatically created with the MFC Wizard.  Malamontagne, I think you have the solution to my problem, but could you please include some code?  Thanks.
0
 
LVL 1

Accepted Solution

by:
ScottyDawg earned 50 total points
ID: 2523324
In 2nd dialog when your button is pushed call

GetParent()->ShowWindow(SW_SHOW);
EndDialoag(ID_OK);


this will work providing that you 2nd dialog was created something like

C2ndDialoag Dlg2(IID, this);

the "this" being the important bit...
0
 

Author Comment

by:neymeyer
ID: 2523386
Just what I was looking for.  I had everything except the GetParent() thing.  Thanks!
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
Fully specialized class template function 21 129
C Language combined operators 28 106
How to convert MFC APP to Win32 APP. 19 69
Add values of each row in an array 3 50
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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 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.

911 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

17 Experts available now in Live!

Get 1:1 Help Now