How do I create an initially hidden, modal dialog box?

How do I create an initially hidden, modal dialog box?

Post by markscottwri.. » Thu, 21 Sep 2000 04:00:00



I'm trying to create a hidden, modal dialog box (it will appear in
response to certain system tray icon messages).  As usual, MFC is
fighting me every step of the way.  The obvious way, de-selecting
WS_VISIBLE, does nothing.  Nor can I call ShowWindow(SW_HIDE) in
OnInitDialog().  The only way I've been able to do this is to set a
timer for a short interval, and then do the ShowWindow(SW_HIDE) in
OnTimer().  But people may someday read this code, and I don't want
them to think I'm an idiot.

Does anyone know the right way to do this?

Mark.

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

How do I create an initially hidden, modal dialog box?

Post by farha » Thu, 21 Sep 2000 04:00:00


You can call SetWindowPos in OnInitiDialog to create the hidden Modal Dialog
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW);
I tried it with Modal Dialog app and it works but you see the app on the
taskbar but no window (not good).  If you call DoModal() makes sense  that
the window be visible.


Quote:> I'm trying to create a hidden, modal dialog box (it will appear in
> response to certain system tray icon messages).  As usual, MFC is
> fighting me every step of the way.  The obvious way, de-selecting
> WS_VISIBLE, does nothing.  Nor can I call ShowWindow(SW_HIDE) in
> OnInitDialog().  The only way I've been able to do this is to set a
> timer for a short interval, and then do the ShowWindow(SW_HIDE) in
> OnTimer().  But people may someday read this code, and I don't want
> them to think I'm an idiot.

> Does anyone know the right way to do this?

> Mark.

> Sent via Deja.com http://www.deja.com/
> Before you buy.


 
 
 

1. ******* How to create hidden modal dialog at startup?? *******

I'm writing a simple program that put an icon on the system tray with no
dialog boxes.  However, in my knowledge, in order to receive callback
messages from the tray icon, the only I can to is to set
NOTIFYICONDATA.hWnd to the handle of a modal dialog box.  My problem is
I don't know how to make that modal dialog hidden at startup even if
WS_VISIBLE is not set.  I've tried to override the CDialog::OnPaint()
function and call ShowWindows(SW_HIDE) first in the overrided function,
but the dialog fresh before it's hide, so it won't work neither.  I've
even tried to override the Cwnd::RunModelLoop() and CDialog::DoModal(),
but neither work.  Can someone give me some suggestion?


2. Disk Cleanup is hanging

3. How to hide a modal dialog box at startup ?

4. Hyperlinks Disabled in OE 5.5

5. How to create a Modal Dialog Box with a customized mouse cursor

6. cannot defrag

7. Creating a Hidden Dialog Box

8. Ad-aware R146 11.06.2003

9. Creating a CList Box from a dialog Resource, using the dialog as the main Window

10. modal dialog box for print

11. Submit a Modal Dialog window create a new popup window

12. Program creates modal dialog in the background!?

13. Modal Dialog Box has 2 process running??