为什么屏幕锁定时气球提示会延迟?
我编写的应用程序显示气球提示(使用 NotifyIcon.ShowBalloonTip()
) 当某个事件发生时。系统锁定时也可能发生这种情况。
在这种情况下,气球提示在解锁后不会立即显示或根本不显示 - 两种情况都很好并且有意义。但是,它会在一段时间后显示 - 有时超过半小时。
这种行为非常烦人,我想知道是否有办法阻止它,除了在显示气球提示之前检查屏幕是否已锁定。
An application I've written displays a balloon tip (using NotifyIcon.ShowBalloonTip()
) when a certain event happens. This can also happen while the system is locked.
In this case the balloon tip does not immediatels display after unlocking it or not at all - both cases would be fine and make sense. However, it displays after some time - sometimes more than half an hour.
This behaviour is very annoying and I'd like to know if there's a way to prevent it except checking if the screen is locked before showing the balloontip.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
任务栏通知(这是官方术语)具有与之相关的棘手逻辑。
通知会立即显示,或者从某些状态恢复后显示,例如当电脑锁定时(或玩全屏游戏时):
http://blogs.msdn.com/ b/oldnewthing/archive/2005/01/10/349894.aspx
在 Vista 及更高版本中,通知仅显示 9 秒,并且不可调整:
http://blogs.msdn.com/ b/oldnewthing/archive/2011/05/18/10165605.aspx
在用户首次登录的第一个小时内根本不会显示通知气球:
http://msdn .microsoft.com/en-us/library/windows/desktop/ee330740(v=vs.85).aspx
最重要的是,Windows 不保证用户会看到他们。在 Windows UX 指南中,他们指出:
它还指出用户也可能无法及时看到消息,在这种情况下,您应该当消息不再相关时将其取消排队。您可以通过调用
ShowBalloonTip(0, String.Empty, String.Empty, ToolTipIcon.None)
来完成此操作。我认为这样做是防止显示不相关的气球的最佳选择。Taskbar notifications (this is the official terminology) have tricky logic associated with them.
Notifications are displayed either immediately, or after resuming from certain states, such as when the PC is locked (or playing a fullscreen game):
http://blogs.msdn.com/b/oldnewthing/archive/2005/01/10/349894.aspx
In Vista and later, notifications are only displayed for 9 seconds, and this is not adjustable:
http://blogs.msdn.com/b/oldnewthing/archive/2011/05/18/10165605.aspx
Notification balloons do not show up at all for the first hour a user is logged on for the first time:
http://msdn.microsoft.com/en-us/library/windows/desktop/ee330740(v=vs.85).aspx
Most importantly, Windows does not guarantee that the user will see them. In the Windows UX Guidelines, they state:
It also states that the user might not see the messages in time either, in which case you should unqueue your messages when they are no longer relevant. You can do this by calling
ShowBalloonTip(0, String.Empty, String.Empty, ToolTipIcon.None)
. I think doing this is your best bet to prevent irrelevant balloons from being shown.