Articles

Use SystemParametersInfo function with SPI_SCREENSAVERRUNNING parameter.

var
  MyW: Word = 0;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
  SystemParametersInfo(SPI_SCREENSAVERRUNNING,1,@MyW,0);
  Label1.Caption:='mode - disable';
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  SystemParametersInfo(SPI_SCREENSAVERRUNNING,0,@MyW,0);
  Label1.Caption:='mode - enable';
end;