Run default screensaver from code
Sometimes it can be useful to run a default screensaver from your application. And doing it is simple. Here is short example made as an OnClick event.
1 2 3 4 5 6 7 |
procedure TForm1.Button1Click(Sender: TObject); var b : boolean; begin if not SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, @b, 0) then exit; if not b then exit; PostMessage(GetDesktopWindow, WM_SYSCOMMAND, SC_SCREENSAVE, 0); end; |