Back


Lennie's Weekly Tip: Turning the ScreenSaver On/Off

25 January 2000 Ref. 11


You can use the following two functions to turn the ScreenSaver on/off.

function TurnScreenSaverOn : boolean;

begin
  Result := SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1, nil, 0);
end;

function TurnScreenSaverOff : boolean;

begin
  Result := SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 0, nil, 0);
end;

Both functions will return a value of TRUE if successful or FALSE, otherwise.

The "TurnScreenSaverOn" will turn the ScreenSaver back on, with the last choosen ScreenSaver has the active ScreenSaver.

More on ScreenSaver settings/information to come next week.


Back