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.htmShowWindow(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 hid开发者_如何学运维e' can i do this in delphi or even better can i hide/show(completely) that icon whenever i want(using delphi)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.
The clock example you cited works, because, although the clock icon is in the same area as the notification tray, it is not actually the same window but a separate window in itself. You can't hide a single icon using the same method because they are all treated as a whole.
You can hide the entire notification tray, though:
ShowWindow(FindWindowEx(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil), 0, 'SysPager', nil), SW_HIDE);
If you're in charge of the computer you're running on, then you just right click the icon and disable it manually. Presumably this writes some settings in registry (use procmon to find out), so you can automate it through Active Directory.
If you're not in charge, meaning it's not yours and just some random computer, and your app voluntarily decides to go ahead and hide icons it doesn't like, then no, there's no API to do that, and screw you for even trying. It's up to user to decide when he wants to hide the icon, not to your super cool program.
精彩评论