Looks like you are setting the screensaver status, not getting it.

Dave.
----- Original Message -----
From: "gajo" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Saturday, April 07, 2001 11:10 PM
Subject: [DUG]: What's wrong with this screen saver?


> OK, this should now detect when the screen saver is on and when it turns
off, and then off - on =
> total, and add that number to a listbox (TL4). So someone tell me why this
code doesn't work?
>
> Thanks, Gajo
>
> ------------------------
> switch: boolean = false;     { this procedure is done by a Timer, so I
need to use a switch that
> would tell when sson or ssoff has changed, and not let the Timer change it
again }
> ....
>
> procedure TForm1.Timer1Timer(Sender: TObject);
> var
>   sson, ssoff, sstotti: TDateTime;
> begin
>
> if switch = false then begin
>  if SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,1,nil,0) <> false then
begin    // ss has activated
>
>   sson := Now;
>   switch := True;
>   end;
>  end else
>
> if switch = true then begin
> if SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,0,nil,0) <> false then
begin
>  ssoff := Now;
>  switch := False;
>  sstotti := ssoff - sson;
>  TL4.Items[index] := TimeToStr(sstotti);
>  end;
> end;
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"

Reply via email to