Back


Lennie's Weekly Tip: Starting the Default ScreenSaver Programatically
07 December 1999 Ref. 07

To start the default screen saver programatically from Delphi, you can use
the following single line of code:

SendMessage(Handle, WM_SYSCOMMAND, SC_SCREENSAVE,  0);

Simply call it inside a procedure/event-handler and it will start the default
screensaver.

You can also write it inside a procedure and add that procedure to a unit,
so that you can call it whenever you need to.


Back