如何随意隐藏任务栏气球?

发布于 2024-07-21 03:10:18 字数 351 浏览 5 评论 0原文

强制任务栏图标显示气球工具提示非常容易:我需要做的就是在调用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

吹梦到西洲 2024-07-28 03:10:18

要立即隐藏气球,请将 NOTIFYICONDATAszInfo 成员设置为空字符串,例如 nid.szInfo[0] = 0; 和调用 Shell_NotifyIcon( NIM_MODIFY, &nid ) 。

To immediately hide a balloon, set the szInfo member of the NOTIFYICONDATA to an empty string, like nid.szInfo[0] = 0; and call Shell_NotifyIcon( NIM_MODIFY, &nid ).

二手情话 2024-07-28 03:10:18

我想说,强行删除通知气球并不符合用户的最佳利益。 有时,用户不会立即查看通知,而几秒钟内发生的缓慢消失让他们有机会在气球消失之前看一眼。 从可用性的角度来看,显示气球应该是应用程序的责任,但删除气球实际上应该是用户的责任。 否则,您可能会隐藏他们实际上有兴趣查看的信息,并且通过立即强制隐藏它,您可以完全消除用户在气球消失期间拥有的“最后机会”。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文