Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dialog box in system tray

Status
Not open for further replies.

rishabhs

Programmer
Nov 25, 2002
5
US
i have an mfc dialog based application.
how can i show the main dialog box in the system tray?[\b]
 
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?

can anyone suggest something?

thanx
 
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.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top