[DUG] CPU usage

Conor Boyd Conor.Boyd at trimble.co.nz
Fri Aug 21 13:57:27 NZST 2009


John,

I just checked back through my emails.  We talked about this back in
June.

There were a number of confirmations of the fact that it apparently
works fine.

That function I posted works perfectly for me on XP as is (compiled
under D2007).  I've just tested it again; same result.

C.

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

Now I remember - I had tried this very code lots, and I had lots of
trouble getting it to work, after some empirical testing I found the
boolean result returned was always interpreted as true unless I copied
the result into another (Delphi)  boolean, in which case it worked.

Is there any problem with a Boolean returned from Win32 routines?

I still think it does not work reliably.

(I have a background program that logs Windows start, shutdown, suspend,
resume and screensaver times automatically.  The screensaver is the one
I have the most trouble with and seems the least reliable)

John

> Not that tricky.
>
> 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
>
> 1 - there is no reliable way I have found to detect when the 
> screensaver has actually started - if you know one please pass it on!



More information about the Delphi mailing list