Search code examples
c#winapinotifyicon

Modify the behaviour of a NotifyIcon with via a 3rd party application


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? :)


Solution

  • 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.