Solved

Z order for modeless dialog

Posted on 2008-06-10
5
1,075 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
ID: 21756619
could you post the code where you create the dialog?  how are you declaring the parent of this dialog?
0
 

Author Comment

by:clintonJ
ID: 21758888
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
ID: 21758984
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
ID: 21758996
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
ID: 31465919
Works Perfectly!!!!  Thanks a bunch.
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
post4 challenge 28 93
Path of Workbook 3 62
Making an alias 7 82
Authentication of Web Services 3 54
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

863 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

25 Experts available now in Live!

Get 1:1 Help Now