如何隐藏其他应用程序/进程的托盘图标(从我的应用程序)?
有人可以告诉我如何使用我的应用程序隐藏/显示其他应用程序/进程的托盘图标,我想隐藏“已连接到互联网”图标(发送/接收数据/两者时这两台计算机都变成蓝色)从我的应用程序
编辑:我可以使用取自 http://scalabium 的代码片段隐藏系统时钟.com/faq/dct0147.htm
ShowWindow(FindWindowEx(FindWindowEx(FindWindow('Shell_TrayWnd', nil), 0, 'TrayNotifyWnd', nil), 0, 'TrayClockWClass', nil), SW_HIDE);
我想我可以使用此代码来隐藏“互联网连接图标”(顺便问一下,该图标叫什么?),也可以通过替换 TrayClockWClass 但替换为哪个类? 我尝试使用名为 windowse 的工具查找类名,但没有运气
edit2:我可以通过左键单击“托盘窗口”然后选择属性并在属性窗口上单击“自定义”按钮然后将图标属性从“不活动时隐藏”更改为“始终隐藏”来隐藏窗口中的这些图标我在delphi中执行此操作,或者更好的是我可以随时隐藏/显示(完全)该图标(使用delphi)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
API 不会公开对其他应用程序图标的访问。唯一的选择是对系统托盘本身进行子类化,以拦截 Shell_NotifyIcon() 发送给它的窗口消息,以便您可以跟踪哪些 HWND 正在注册哪些图标 ID。
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:
如果您负责正在运行的计算机,则只需右键单击该图标并手动禁用它即可。据推测,这会在注册表中写入一些设置(使用 procmon 来查找),因此您可以通过 Active Directory 将其自动化。
如果你不负责,这意味着它不是你的,只是一些随机的计算机,并且你的应用程序自愿决定继续隐藏它不喜欢的图标,那么不,没有 API 可以做到这一点,甚至让你操蛋尝试。由用户决定何时隐藏图标,而不是由您的超酷程序决定。
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.