dear all
i have an mfc diallog based app with frame as main window.
on app start an icon appears at the system tray and on dbl clicking that a dialog box appears. the problem is that on every dbl click, a new dialog box appears
how do i ensure that only one dialog appears at a time?
Although not "Bullet Proof" this may help:
In you Dialog's InitInstance() add this:
CWnd* PrevWnd, ChildWnd;
// Returns NULL if no such window is found
PrevWnd = CWnd::FindWindow(NULL, "NameOfYourDialogWindow"
if (PrevWnd)
{
ChildWnd = PrevWnd->GetLastActivePopup();
PrevWnd->BringWindowToTop();
// If iconic, restore the main window
if (PrevWnd->IsIconic())
PrevWnd->ShowWindow(SW_RESTORE);
}
else
MessageBox, whatever you want to do.....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.