MFC tray icon(please help)
-
Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give
Write a handler for WM_SYSCOMMAND and in it check nID. if it is SC_CLOSE, dont shut down the application, just hide it or minimize it to system tray, whatever you want to do. "I would luv to change the world, but they wont give me the source code" :( My Articles
-
Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give
Just don't exit the application. Hide the main window when user wants to exit. Show it when user clicks on icon. --OR-- Write another app, which also has the same icon in the tray. Just a small app which never shows its interface, it is hidden. When user exits main app, it starts this small app before exiting. When user clicks on icon, this small app starts the main app, and exits itself. Good code for life.
-
Hi, I have written a program to add an icon in the system tray. But i want the icon to remain in the systray even after i exit the application and the application should start on clicking the icon. how can i do that? Thanks U get wht u Give
charu123 wrote: But i want the icon to remain in the systray even after i exit the application You can't do that. Tray icons work by sending window messages, so if your app exits there is no longer a window to send messages to. You'll need two apps, your main app, and one that's responsible for the tray icon. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD