中断活动的屏幕保护程序编程?屏幕保护程序

2023-09-03 06:59:06 作者:初冬い雪落成殇

原因: 我的工作需要显示在桌面上信息的紧急警报应用程序。当客户端收到警报后,它会弹出一个窗口。如果屏幕保护程序处于激活状态或显示器处于待机警报将不可见。我不知道是否有可能通过某种程序上的鼠标移动或系统调用来唤醒计算机,使警报将是可见的。我想原因鼠标移动或按键preSS唤醒它是因为中断,因此可能无法硬件。

REASON: I'm working on an emergency alert application that needs to display information on a desktop. When the client receives an alert, it pops up a window. If a screensaver is active or the monitor is in standby the alert will not be visible. I'm wondering if it's possible to wake the computer up via some sort of programatic mouse move or system call so that the alert would be visible. I think the reason a mouse move or keypress wakes it up is because of a hardware interrupt so it may not be possible.

目前,该项目正在用C#实现。 我很感兴趣地听到有关Windows,Mac和Linux解决方案。

Currently, the project is being implemented in C#. I'm interested to hear about solutions for Windows, MAC, and Linux.

这是一个客户的要求。我已经考虑了以下内容:

This is a customer request. I have considered the following:

在活动之后大多数的计算机用户必须登录。这些计算机不会得到警报 有一个很好的机会,如果屏幕处于活动状态,那么没有人是在电脑反正。

我并不是想:

prevent屏幕保护程序或节能模式中一起启动。

推荐答案

建立在什么fbonnet说,使用了的 KB 文章在C#中 pinvoke.net 网站是一个很好的资源。他们还对 PostMessage的函数的这里。

Building on what fbonnet said, to use the functions shown in the kb article in C# the pinvoke.net site is a great resource. They also have a article on the PostMessage function here.

所以,让你的code工作的基本途径可能是搜索的 KB列出的功能< /在 pinvoke.net 网站>的文章。 或你可以阅读这篇文章已经做了你

So the basic way of getting your code working could be searching the functions listed in the kb article on the pinvoke.net site. Or you can read this article has done that for you.