如何随意隐藏任务栏气球?
强制任务栏图标显示气球工具提示非常容易:我需要做的就是在调用 Shell_NotifyIcon( NIM_MODIFY, ... ) 时设置 NIF_INFO 标志,气球就会出现,没问题。
现在,我也希望能够在不再需要气球时将其隐藏起来,但我找不到方法来做到这一点。 我尝试清除 NIF_INFO 标志并调用 Shell_NotifyIcon( NIM_MODIFY, ... ),但气球仍然存在。 几秒钟后,它确实会自行消失,但这不是我想要的:当我的程序认为应该隐藏它时,我想立即隐藏它。
让气球消失的唯一方法似乎是销毁图标,然后再次将其添加到任务栏,但它很难看。
是否可以隐藏气球而不重新创建任务栏图标? 谢谢。
It's very easy to force a taskbar icon to display a balloon tooltip: all I need to do is set the NIF_INFO flag when calling Shell_NotifyIcon( NIM_MODIFY, ... ), and the balloon appears, no problem.
Now, I want to be able to hide the balloon when I no longer need it, as well, but I can't find a way to do that. I tried clearing the NIF_INFO flag and calling Shell_NotifyIcon( NIM_MODIFY, ... ), but the balloon remained. It does disappear by itself, a few seconds later, but that's not what I want: I want to hide it right away, when my program thinks it should be hidden.
The only way to make the balloon disappear seems to be to destroy the icon and then add it to the taskbar again, but it's ugly.
Is it possible to hide the balloon without recreating the taskbar icon? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要立即隐藏气球,请将
NOTIFYICONDATA
的szInfo
成员设置为空字符串,例如nid.szInfo[0] = 0;
和调用 Shell_NotifyIcon( NIM_MODIFY, &nid ) 。To immediately hide a balloon, set the
szInfo
member of theNOTIFYICONDATA
to an empty string, likenid.szInfo[0] = 0;
and callShell_NotifyIcon( NIM_MODIFY, &nid )
.我想说,强行删除通知气球并不符合用户的最佳利益。 有时,用户不会立即查看通知,而几秒钟内发生的缓慢消失让他们有机会在气球消失之前看一眼。 从可用性的角度来看,显示气球应该是应用程序的责任,但删除气球实际上应该是用户的责任。 否则,您可能会隐藏他们实际上有兴趣查看的信息,并且通过立即强制隐藏它,您可以完全消除用户在气球消失期间拥有的“最后机会”。
I would offer that its not really in the best interest of the user to forcibly remove a notification balloon. Sometimes a user doesn't look at a notification immediately, and that slow fade away that happens over a couple seconds gives them a chance to take a look before the balloon is gone. From a usability perspective, displaying the balloon should be the responsibility of the application, but removal of the balloon should really be the responsibility of the user. Otherwise, you could be hiding information they were actually interested in seeing, and by forcibly hiding it immediately, you completely remove that "last chance" the user has during the balloons fade away.