Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hide main window leaving task bar icon, MFC dialog showing

196 views
Skip to first unread message

Woody Howru

unread,
Mar 29, 2012, 7:23:43 PM3/29/12
to
A class based on CWnd is my main window. From this, it is possible, by clicking on various parts, to start MFC dialogs. At this time, I want the MFC dialog to be visible, the main window to be invisible, and the icon from my main window to remain in the task bar. I cannot seem to accomplish these all at once.

Typical code for starting the MFC dialog is

CMyMFCDialog *pDlg=new CMyMFCDialog;
pDlg->DoModal();
delete pDlg;

If I precede this with ShowWindow(SW_HIDE) in the main window class, the main window vanishes, and so does the task bar icon.

If instead I use ShowWindow(SW_MINIMIZE), the task bar icon remains, as wanted, but the modal dialog is not visible.

I can't use pDlg->ShowWindow in the main window class, because the dialog window has not yet been created.

Even if I put ShowWindow(SW_SHOW) (or SW_NORMAL) in the OnInitDlg handler in CMyMFCDialog, the dialog remains invisible. It can only be made visible by toggling the task bar icon.


0 new messages