问题
Ok, so I found some code to check if a screensaver is running and kill it if I want to. This doesn't seem to work on Windows 7 PCs. Does anyone know how this code can be modified, or provide new code to accomplish this?
My application is designed to run in the background until a particular event occurs, and then create and display a full screen notification. This needs to be displayed even if a screen saver is currently up.
Thanks in advance for your help.
回答1:
The easiest way is to fake a mouse move event with x=y=0 by calling SendInput().
回答2:
The following question may provide some insight:
How to turn screensaver on (windows 7) by a code (in cmd)?
However, what if the machine is locked? I don't think you'll be able to display any application on top of the lock screen unless it is actually a screensaver (and even then it may not be possible)
回答3:
Assuming you don't have a password-protected screensaver: (from http://support.microsoft.com/kb/140723)
PostMessage (GetActiveWindow(), WM_CLOSE, 0, 0L);
来源:https://stackoverflow.com/questions/5474802/how-do-i-turn-off-the-windows-screen-saver-if-it-is-running-using-c