http://msdn.microsoft.com/en-us/library/windows/desktop/ms724947%28v=vs.85%29.aspx
#include <cstdio>
#include "windows.h"
using namespace std;
unsigned int bScreensaverActive, nScreensaverTimeout, bSecure;
void get_setting() {
//To read
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &bScreensaverActive, 0);
SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &nScreensaverTimeout, 0);
SystemParametersInfo(SPI_GETSCREENSAVESECURE, 0, &bSecure, 0); // Windows Server 2003 and Windows XP/2000: This parameter is not supported.
printf("Active: %d, Timeout: %d seconds, Secure: %d\n", bScreensaverActive, nScreensaverTimeout, bSecure);
}
int main() {
puts("setscrsave: Set screen saver timeout to 10 minutes or under.");
puts("(C) 2013 KIM Taegyoon\n");
puts("Before:");
get_setting();
nScreensaverTimeout = min(nScreensaverTimeout, 600);
//To set
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, nScreensaverTimeout, NULL, SPIF_SENDCHANGE);
SystemParametersInfo(SPI_SETSCREENSAVESECURE, true, NULL, SPIF_SENDCHANGE); // Windows Server 2003 and Windows XP/2000: This parameter is not supported.
puts("After:");
get_setting();
puts("Opening [Screen Saver] page...");
system("control desk.cpl,,@screensaver");
system("pause");
}
'My Computer Programs' 카테고리의 다른 글
(JavaScript) Set Difference (0) | 2013.06.08 |
---|---|
(Scheme) primes (0) | 2013.05.05 |
(JavaScript) SweepSecond (0) | 2013.04.03 |
nbtstat-a.bat (0) | 2013.03.14 |
My repositories on Bitbucket (0) | 2013.03.14 |