Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent leaving an Icon in System Tray on exit?

My program puts an icon in the system tray because the user may minimize to it. However, if the application crashes, or I stop the app from running in VS it leaves the icon in it until I hover over it with the mouse. Sometimes I'll look down there and there will be 10 or so icons.

I can I make sure the icon goes away?

like image 431
Malfist Avatar asked Oct 26 '09 20:10

Malfist


People also ask

How do I make an app minimize to system tray when closed?

Run the program from its folder or from a shortcut you've created. Switch to whichever window you'd like to minimize to the tray. Press Alt + F1 and that window will minimize to the tray.


1 Answers

There is no way to do this. Windows does not poll your program to see if it's still alive. Therefore, your icon will stay in the system tray until you either tell it to leave (normal exit), or the user does something that initiates a call to your program (such as mouseover). Only then does the shell know that your program has died and it needs to clean up your icon.

like image 58
JSBձոգչ Avatar answered Sep 29 '22 00:09

JSBձոգչ