• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1104
  • Last Modified:

Z order for modeless dialog

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.
  • 2
  • 2
1 Solution
Jaime OlivaresSoftware ArchitectCommented:
could you post the code where you create the dialog?  how are you declaring the parent of this dialog?
clintonJAuthor Commented:
The MODAL parent dialog is launched from another dialog. The parent is created as follows:

CParentDialog dlgParent;

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))  

Is the modal dialog the main application window? If not, pass the main application window as parent:

m_pChildDialog = new CChildDialog(AfxGetMainWindow());
Sorry, I didn't read your last comment very well...

You can try this:

m_pChildDialog = new CChildDialog( GetParent() );
clintonJAuthor Commented:
Works Perfectly!!!!  Thanks a bunch.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now