Click to See Complete Forum and Search --> : Modeless dialog overdrawing all windows


September 10th, 1999, 12:30 PM
Hi, I recently converted a modal dialog to a modeless one. It works fine but always seems to be on top of any other windows no matter if it is active or not. In fact it even appears on the screen when it is inactive and another window is maximized. I believe was due to it having the WS_OVERLAPPED style.

In order to stop this I have tried to set its style to WS_CHILD, but this seems to stop it from working at all. The contents of the dialog are displayed but do not respond to any events. If another window is dragged over it or maximized the dialog is painted over and disappears.

There has to be a simple way to have a modeless dialog that does not stick on top of everything else. Unfortunately as my dialog was derived from a modal one I cannot see anyway other than to totally rewrite the entire creation and message handling code.

Please help, thanks

September 10th, 1999, 12:33 PM
PS. I am not using MFC..

SteveH
September 10th, 1999, 01:13 PM
The Modeless dialog will always on top of the windows. You have to rewrite the dialog as normal window and handle all the messages.

deckard
October 17th, 2002, 12:50 PM
I ran accross this same problem myself. I found a work around that allowed parent and child dialogs to overlap one another.

To implement the workaround create an invisible window as discussed in the following article:

http://www.codesoup.com/asp/tiptext.asp?pagefile=invisiblewin.pag&type=mfc

Make the invisible window the parent of your child dialogs. Then the parent window can overlap the child window.

Philip Nicoletti
October 17th, 2002, 01:17 PM
Well, in MFC you can set the parent window to GetDesktopWindow() when you create the
modeless dialog to accomplish this.

Maybe you do something along those lines in non-MFC.

galathaea
October 17th, 2002, 01:28 PM
Actually, GetDesktopWindow is an API exported from user32.dll! So should work fine.