Search code examples
delphisystem-traytrayicon

How do I hide tray icons of other applications/processes (from my app)?


can some one show me how to hide/show tray icons of other applications/processes using my application,i want to hide the ''connected to internet''icon(those two computers that turn blue when data is sent/recieved/both) from my app
edit: i can hide system clock using this snippet taken from http://scalabium.com/faq/dct0147.htm

ShowWindow(FindWindowEx(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil), 0, 'TrayClockWClass', nil), SW_HIDE);

i guess i can use this code to hide ''internect connection icon''(by the way what is that icon called?) as well by replacing TrayClockWClass but by which class? i have tried to find class name using this tool called windowse but with no luck
edit2: i can hide those icons in windows by leftclicking 'tray window' then selecting properties and on properties windows clicking 'customize' button then changing icons property from 'hide when inactive' to 'always hide' can i do this in delphi or even better can i hide/show(completely) that icon whenever i want(using delphi)


Solution

  • The API does not expose access to other apps' icons. The only option is to subclass the system tray itself to intercept the window messages that Shell_NotifyIcon() sends to it so you can keep track of which HWNDs are registering which icon IDs.