在 C# 中重置任务栏 Flash
我有一个应用程序,如果发生事件,任务栏就会闪烁。这工作得很好,并且使用如下所述的 Win32 API 相对容易实现: http://blogs.x2line.com/al/archive/ 2008/04/19/3392.aspx
但是,当我停止闪烁时,有时应用程序会卡在任务栏中的“突出显示”状态。这只能通过单击任务栏中的应用程序、最小化它,然后重新最大化它来重置。有没有办法在没有任何用户交互的情况下清除它的突出显示?
I have an application where the taskbar flashes if an event has occurred. This is working perfectly, and was relatively easy to implement using a Win32 API described below:
http://blogs.x2line.com/al/archive/2008/04/19/3392.aspx
However, when I stop the flashing, sometimes the application is stuck in the "highlighted" state in the taskbar. This only gets reset by clicking on the application in the taskbar, minimizing it, then re-maximizing it. Is there a way to clear this from being highlighted without any user interaction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许您可以在其上放置一个覆盖图标,而不是闪烁它 - 来自 C# 的一行代码和代码包。然后,当您想要清除它时,您可以将覆盖图标拿走 - 又是一行代码。但仅限 Windows 7。
Maybe instead of flashing it you could put an overlay icon on it - one line of code from C# with the Code Pack. Then when you want to clear it you could take the overlay icon away - again one line of code. Windows 7 only, however.
您可以发布您用来“停止”闪烁的代码吗?
您是否也考虑过使用不同的标志,例如:
// flash until the window come to the foreground
FLASHW_TIMERNOFG = 12;
您仍然需要单击应用程序才能停止闪光灯,但不必最小化然后重新最大化应用程序才能停止闪光灯。
Can you post the code that you are using to "Stop" the flashing?
Have you also considered using a different flag such as:
// flash until the window comes to the foreground
FLASHW_TIMERNOFG = 12;
You will still need to click on the applicaiton to get the flash to stop, but you should not have to minimize then re-maximize the app to get the flash to stop.
您可以包含 FlashTaskbar 代码段并使用以下代码
FlashWindow(Form .Handle,FlashMode.FLASHW_STOP)
You can include the FlashTaskbar snippet and use the following code
FlashWindow(Form.Handle, FlashMode.FLASHW_STOP)