Solved

Z order for modeless dialog

Posted on 2008-06-10
5
1,088 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

734 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