Solved

Z order for modeless dialog

Posted on 2008-06-10
5
1,069 Views
Last Modified: 2013-12-14
I have a VC 6.0 app.  I am launching a modeless dialog from a modal dialog.  But the modeless dialog ALWAYS remains on top of the modal dialog.  So, while I can access the modal dialog underneath, it never gets above the modeless dialog in the Z order.

Your help is greatly appreciated.
0
Comment
Question by:clintonJ
  • 2
  • 2
5 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
Comment Utility
could you post the code where you create the dialog?  how are you declaring the parent of this dialog?
0
 

Author Comment

by:clintonJ
Comment Utility
The MODAL parent dialog is launched from another dialog. The parent is created as follows:

CParentDialog dlgParent;
dlgParent.DoModal();

The MODELESS child dialog is created as follows:

In the parent dialog's header file, I declare a pointer to the modeless child, like this:

CChildDialog* m_pChildDialog;

Then, in the parent dialog class, I have a button click message handler to create the child dialog.  I n that message handler, I have the following:

m_pChildDialog = new CChildDialog(this);


Finally, in the child dialog's constructor, I have this code, to create and show the child dialog:

if (Create(CCptDialog::IDD, pParent))  
{      
      ShowWindow(SW_SHOW);      
}


0
 
LVL 19

Expert Comment

by:alb66
Comment Utility
Is the modal dialog the main application window? If not, pass the main application window as parent:

m_pChildDialog = new CChildDialog(AfxGetMainWindow());
0
 
LVL 19

Accepted Solution

by:
alb66 earned 500 total points
Comment Utility
Sorry, I didn't read your last comment very well...

You can try this:

m_pChildDialog = new CChildDialog( GetParent() );
0
 

Author Closing Comment

by:clintonJ
Comment Utility
Works Perfectly!!!!  Thanks a bunch.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

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

16 Experts available now in Live!

Get 1:1 Help Now