如何从部分受信任的 .NET 应用程序刷新任务栏?
我想闪烁任务栏(例如此处描述的),但我不能P /Invoke FlashWindowEx(或其他任何东西)在我的应用程序运行的安全上下文中。
是否有其他方法可以让任务栏闪烁? 如果没有,我有哪些选择可以吸引用户的注意?
I'd like to flash the taskbar (as described here for example), but I can't P/Invoke FlashWindowEx (or anything else, for that matter) in the security context my application is running in.
Is there another way to get the taskbar to flash? If not, what are my options for getting the user's attention?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕没有其他方法可以使窗口从部分受信任的代码闪烁。 您也不能将表单提升到前面,因为没有办法像这样抢走焦点。 您不能使用 NotifyIcon,甚至不能使用部分信任的 MessageBox,所以看来您运气不好。
以下是 在 WinForms 中不能执行的操作列表。
看起来您唯一的选择是找到一种方法来提升代码的权限(也许对其进行签名并要求用户信任您的证书)。 除此之外,只需等待用户点击您的应用程序即可!
I'm afraid there is no other way to make the window flash from partially trusted code. You can't raise the form to the front either as there is no way to steal the focus like this. You can't use a NotifyIcon, or even a MessageBox from partial trust either, so it seems you are out of luck.
Here is a list of things you can't do in WinForms.
It looks like your only option is to find a way to elevate your code's privileges (perhaps get it signed and ask the user to trust your certificate). Aside from that, just wait until the user clicks on your app!