通知图标删除 [英] Notifyicon removal

查看:83
本文介绍了通知图标删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过编程方式从仍显示在托盘中的其他程序中删除剩余的notifyicon?

Is there a way to programmatically remove a leftover notifyicon from some other program still showing in the tray?

推荐答案

在较早版本的Windows(Windows 7之前的版本中),您可以强制托盘区域刷新/重新绘制以执行此操作.但是我不确定它是否仍可以在Windows 7上运行.

编辑/更新
------------

这是对您的评论的回应.在两种情况下会留下恶意图标:

1)当应用程序退出而未显式删除图标时.现在这会使图标句柄无效.通过强制刷新内部工具栏窗口,此图标将被自动删除.如果将鼠标移至孤立图标周围,您会看到此信息.

2)应用程序崩溃并进入僵尸状态,而该进程实际上并未终止.在这种情况下,您无法以书面形式进行太多操作.但是,如果您想走无证的路线,请看一下我几年前写的这篇文章:

http://www.codeproject.com/KB/applications/ShellTrayInfo.aspx [ ^ ]

它尚未在Windows 7上进行过测试,所以我不知道该如何在该OS上推出.
In older versions of Windows (pre-Windows 7), you could force the tray area to refresh/redraw to do this. But I am not sure it will still work on Windows 7.

Edit/Update
------------

This is in response to your comment. There are two cases where a rogue icon is left behind:

1) When the app exits without explicitly removing the icon. This now invalidates the icon handle. By forcing a refresh of the inner toolbar window, this icon will be auto-removed. You can see this if you move your mouse around the orphan icon.

2) The app crashes and goes into a zombie state without the process actually terminating. In this case there''s not much you can do in a documented manner. But if you want to go the undocumented route, take a look at this article I wrote a few years ago:

http://www.codeproject.com/KB/applications/ShellTrayInfo.aspx[^]

It''s not been tested on Windows 7 so I have no idea how that''ll pan out on that OS.


感谢您的快速响应.
就我而言,我故意杀死一个进程,该进程会在托盘中留下一个您所谓的流氓图标".
我找到了以下文章,并获取了我需要的代码.
再次感谢...
http://www.codeproject.com/KB/system/TrayIconBuster.aspx
Thank you for your fast response.
In my case, I''m purposely killing a process that creates what you’re calling a "rogue icon" left in the tray.
I found the following article and grabbed the code I need.
Again, thanks…
http://www.codeproject.com/KB/system/TrayIconBuster.aspx


这篇关于通知图标删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆