Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: PowerBuilder
Expertise: Beginner
May 29, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

How to make application disable/invoke the current screen-saver

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 under Windows 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 decimal 16, to get the current setting, and SPI_SETSCREENSAVEACTIVE action, which is decimal 17. The uiParam should be set to the value TRUE/FALSE for the new setting, and a Boolean passed by reference in pvParam to receive the current setting.
DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date