In Inno Setup, how can I update the notification area, (aka the system tray)? Specifically, I'm installing a service in the Code section which puts an icon in the tray. I'd like to delete it immediately, preferably still in the Code section. (Or not put the icon there at all but I don't think that's possible). When I move the mouse over the icon, it immediately disappears. Can Inno send a message to the tray so that this happens automatically?
-
1That service must improperly kill some process with a UI (which owns the tray icon). You are out of luck if you don't know at least the handle to that icon (to call the `Shell_NotifyIcon` function with `NIM_DELETE` message). Well, [`you might not be`](http://www.codeproject.com/Articles/19620/LP-TrayIconBuster) but that is rather hacky project. If that is your service, proper closing of the UI owning that icon is the cure. Similar has been asked e.g. [`here`](http://stackoverflow.com/q/8342614/960757). – TLama Sep 02 '14 at 12:29
1 Answers
I'm guessing you are using taskkill to kill the task. If not, please disregard this answer :-)
But, if so, then I had the exact same problem, and fixed it with a simple change to my bat file and without having to install any other programs.
The problem was I was running taskkill with /f wich forces (hard) kills the task. If you kill it without the /f it sends a close signal to the application, the application exits cleanly and removes its system tray icon.
In my bat file I do two taskkill commands; the first without the /f and then again with the /f. If the first one works (which it usually should) then all is well and the system tray icon goes away. If for some reason the first one fails, the the second one will still kill it, although in that case the system tray icon would not be removed.
So, in my case, I use: taskkill /t /im Memu* taskkill /f /t /im Memu*
Works great :-)

- 146
- 1
- 6