-
December 16th, 2015, 11:23 AM
#1
Prevent screen saver from activating
Windows 10, visual Studio, c++
There are some times when I want to prevent the screen saver for activating when there has been no input from the user. But not all the time.
What is the most simple way I can generate some data in an app and make the computer think someone pecked a key or moved the mouse?
-
December 18th, 2015, 06:07 AM
#2
Re: Prevent screen saver from activating
This worked in win 7 and earlier, and I see no reason why it should not work in Win 10:
Code:
int timeout;
if(SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &timeout, 0))
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeout, NULL, 0);
You need to call it periodically, once every 30 seconds or so.
Nobody cares how it works as long as it works
-
December 19th, 2015, 10:10 AM
#3
Re: Prevent screen saver from activating
You may want to use SetThreadExecutionState in addition to the above - to prevent sleeping.
gg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|