Interrupt an active screensaver programmatically?

谁都会走 提交于 2019-12-09 17:21:15

问题


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.

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:

  • On most computers after inactivity, the user must login. Those computers will not get the alert
  • There is a good chance that if a screensaver is active, then noone is at the computer anyway.

I am NOT trying to:

  • Prevent a screensaver or energy savings mode to be activated all together.

回答1:


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.

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.



来源:https://stackoverflow.com/questions/864129/interrupt-an-active-screensaver-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!