I've always been curious to see if I can show, hide or change a NotifyIcon created by another application via a C# application.
Could someone please post an example on how to do this? :)
I've always been curious to see if I can show, hide or change a NotifyIcon created by another application via a C# application.
Could someone please post an example on how to do this? :)
I am not aware of anything, unless that other application exposes some public method, or you try to use reflection, but I'm not even sure that you can do that on a running process.
To modify icons in the systray, you can use Shell_NotifyIcon Win32 API (P/Invoke declaration). The icons are associated with a window handle and an id. That means that to modify or hide another program's icon, you need to know the window and the id used by that application to register it. You might be able to brute force it by enumerating all windows for that process and making calls with each handle and each number between 0 and 5000 thousands for example, but your chances of success are very slim.
You can hook the SystemTray window itself to intercept all Shell_NotifyIcon() requests. Then you will know the exact HWNDs and IDs that are registered for each icon. Details can be found via any search engine.