有没有办法让气球尖永远不会关闭?

发布于 2024-10-03 10:23:35 字数 161 浏览 4 评论 0原文

我的应用程序是一个监视器,可以在用户离开时在后台运行,其目的是在发生某些更改时以视觉方式提醒用户。消息框看起来有点令人讨厌,所以我认为气球提示可以完成任务,而不会扰乱焦点,以防它们碰巧在做某事。

不幸的是,这需要一个超时参数。我希望它无限期地保留,直到用户关闭它。

这可能吗?

My application is a monitor that may run in the background while the user is away, and its purpose is to visually alert the user when some changes have occurred. MessageBoxes seem a little obnoxious, so I figure a Balloon Tip will accomplish the task without messing with the focus in case they happen to be doing something.

Unfortunately, the thing requires a timeout parameter. I would like for it to stay indefinitely until the user closes it.

Is this possible?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

南薇 2024-10-10 10:23:35

Windows 已经解决了这个问题。超时计数器在检测到键盘或鼠标输入之前不会开始计时。来自 NotifyIcon.ShowBalloonTip 的备注部分:

此外,如果用户不
似乎正在使用计算机(没有
键盘或鼠标事件是
发生),那么系统不会
这次计入超时时间。

This is already taken care of by Windows. The timeout counter doesn't start ticking until it detects keyboard or mouse input. From the Remarks section of NotifyIcon.ShowBalloonTip:

In addition, if the user does not
appear to be using the computer (no
keyboard or mouse events are
occurring) then the system does not
count this time towards the timeout.

凡尘雨 2024-10-10 10:23:35

据我所知,不可能指定无限超时。

也就是说,如果您将超时设置为 Int32.MaxValue,工具提示将等待 2,147,484 秒,即大约 25 天。那时您的用户很可能已经注意到工具提示,或者他/她永远不会。

编辑: @Hans Passant 提到了一个系统设置,该设置对超时值设置了上限,因此......这可能根本不起作用。无论如何,他的答案更好。

As far as I can tell, it's not possible to specify an infinite timeout.

That said, if you set the timeout to Int32.MaxValue, the tooltip will wait for 2,147,484 seconds, i.e. roughly 25 days. Chances are that your user will have noticed the tooltip by then, or that he/she never will.

EDIT: @Hans Passant mentions a system setting that puts an upper bound on the timeout value, so... that probably won't work after all. His answer is better anyway.

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