[DUG] Windows UI during Screensaver

Conor Boyd Conor.Boyd at trimble.co.nz
Fri Aug 3 11:07:02 NZST 2007


function IsScreenSaverActive: Boolean;
begin
  SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, @Result, 0);
end;

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of John Bird

So what is the best way to detect the screensaver is on?  The best way I
know so far is

P:array[0..256] of Char;
Title:string;
ScreenSaverOn:Boolean:
..

  GetWindowText(GetActiveWindow,p,256);
  title:=p;
  if title='' then ScreenSaverOn:=true;

Which is sort of indirect - the screensaver is the only window with a
blank title text.  It is possible to detect if the mouse and keyboard
are idle, but that does not mean the screensaver has come on of course.

Is there anything more direct to detect the screensaver?



More information about the Delphi mailing list