Tech Support > Microsoft Windows > Development Resources > LESSON LEARNED: Placing a modeless dialog behind a parent.
LESSON LEARNED: Placing a modeless dialog behind a parent.
Posted by DL on August 5th, 2004


I ahave a modeless dialog I want to place behing the invoking
application when an MDI window or the application is selected. I tried
many ways to do this:
1- Make it an overlapped dialog instead of a popup (did not work)
2- Make it an unowned window (Set the CWnd* parameter of the Create
call = NULL) (did not work)
3. Set a window type flag of WS_EX_APP_WINDOW (did not work)
4. Set the CWnd* parameter of the Create call to GetDesktopWindow() -
(this works.)

So the solution is to create the modeless dialog as a child of the
desktop. Now, this is VERY bad if the dialog is modal (see the
discussion at
http://blogs.msdn.com/oldnewthing/ar.../24/79212.aspx)
However, it appears to work just fine for a modeless dialog.

All comments will be greatly appreciated...David

Posted by Frank Renner on August 5th, 2004


Making it an unowned window does work. It doesn't work however when using
Create, because behind the scenes Create makes the main frame own the dialog
when passing NULL as the parent window. You could use CreateDlgIndirect but
you would have to manually read the dialog template from the resources then.

Regards,
Frank




Similar Posts