Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interrupt an active screensaver programmatically?

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.
like image 933
blak3r Avatar asked May 14 '09 15:05

blak3r


1 Answers

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.

like image 112
EKS Avatar answered Nov 07 '22 15:11

EKS