如何prevent在退出留下一个图标在系统托盘? [英] How to prevent leaving an Icon in System Tray on exit?

查看:137
本文介绍了如何prevent在退出留下一个图标在系统托盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序将在系统托盘中的图标,因为用户可以最大限度地减少它。但是,如果应用程序崩溃,或者我停止在VS运行应用程序,它留下的图标,直到我在它与鼠标悬停。有时我会看不起那里,将有10家左右的图标。

My program puts an icon in the system tray because the user may minimize to it. However, if the application crashes, or I stop the app from running in VS it leaves the icon in it until I hover over it with the mouse. Sometimes I'll look down there and there will be 10 or so icons.

我我可以确保该图标会消失?

I can I make sure the icon goes away?

推荐答案

有没有办法做到这一点。 Windows不轮询您的程序,看它是否还活着。因此,你的图标会留在系统托盘中,直到您告诉它离开(正常退出),或者用户做一些事情,发起呼叫到你的程序(如鼠标悬停)。只有这样,它的外壳知道你的程序已经死亡,它需要清理你的图标。

There is no way to do this. Windows does not poll your program to see if it's still alive. Therefore, your icon will stay in the system tray until you either tell it to leave (normal exit), or the user does something that initiates a call to your program (such as mouseover). Only then does the shell know that your program has died and it needs to clean up your icon.

这篇关于如何prevent在退出留下一个图标在系统托盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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