I have a small application that monitors Windows’ resources GDI and users as well as controlling Windows’ exit/restart/reboot. I would like it to be able to disable/invoke the current screen-saver as well. I can’t find anything in the Windows SDK to help me.
The API function to enable and disable the screen-saver underWindows is
SystemParametersInfo, a function responsible for getting and setting most of the control panel settings such as double-click speed, mouse trails, screensaver timeout, icon title wrap and screen-saver active.
The format of the command is as follows:
BOOL SystemParametersInfo( UINT uiAction, // system parameter to query or set UINT uiParam, // depends on action to be taken PVOID pvParam, // depends on action to be taken UINT fWinIni // user profile update flag );You will need to use the SPI_GETSCREENSAVEACTIVE action, which is decimal16, to get the current setting, and SPI_SETSCREENSAVEACTIVE action, whichis decimal 17. The
uiParam should be set to the value TRUE/FALSE for the newsetting, and a Boolean passed by reference in
pvParam to receive thecurrent setting.