R – re-gain a systray icon of a running app that has gone missing

delphiiconsrefreshsystray

Since I've finally got an answer for this question: Can you send a signal to windows explorer to make it refresh the systray icons, that asks about getting rid of dead systray icons, I would like to ask for the opposite.

Is there a way to "nudge" an application to re-show it's systray icon if it has been lost?

It happens to my Apache Monitor ever since I install Avira AV.
Ok, granted, it could only be a side effect, but it's quite annoying to have the running app killed an then restart it, just because it's not displaying the systray icon correctly.

Thanks in advance,
Gus

Best Solution

I've written a project that sends a TaskbarCreated message to all of the top-level windows in the system. If they've registered a tray icon, that should cause them to restore the icon after explorer has crashed.

I've released the source under the MIT license, and provided a link to the compiled console application (with Lazarus) in the readme file.

There are certainly a few refinements that could be made, like not sending the message if the icon is known to be in the tray already, but for now this app causes the icons that I know go missing on an Explorer crash to reappear.

Related Question