I'm writing an application in C++ that runs as a system tray icon. When the application initially starts up the main dialog loads up and takes focus, which isn't the behavior I intend it to have. Is there a way to load the system tray icon without having the main dialog load up?
+2
A:
I'd say you have to separate your systray code and your window code, and only display the window when the systray is called. however you can always call
ShowWindow(SH_HIDE);
OneOfOne
2009-07-28 05:54:22
+1
A:
If you used the standard mfc project wizard, then the code that displays the dialog is in your applications's InitInstance method.
Just comment out the dlg.DoModal()
and m_pMainWnd = &dlg;
parts and you will be fine.
Note that you might have to code your own message loop otherwise your application will just exit after these changes.
Can
2009-07-28 07:14:52