[DUG] Detecting screensaver

Conor Boyd Conor.Boyd at trimble.co.nz
Wed Jun 10 16:22:22 NZST 2009


Re-reading this, I may have been getting confused between the little
preview window and hitting the preview button.

Regardless, it still wouldn't surprise me if a screensaver running from
the Preview button doesn't exhibit the same behaviour.  For example,
when I hit the Preview button on my work PC, my desktop doesn't get
cleared when the Preview runs.  My desktop does get cleared when the
screensaver is truly running.

-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Conor Boyd
Sent: Wednesday, 10 June 2009 4:04 p.m.
To: NZ Borland Developers Group - Delphi List
Subject: Re: [DUG] Detecting screensaver

Wouldn't surprise me if the preview button doesn't exhibit the same
behaviour.

Screensavers have to be written to respond explicitly to being run in
preview mode (they basically have to parent themselves to the window
handle of the preview window which is passed to them when they're
executed in Preview mode).

I believe your test is the correct approach, John (as backed up here:
http://stackoverflow.com/questions/510734/how-to-determine-that-a-screen
saver-is-running and with my own experience of writing a screensaver in
Delphi).

Rather than using the Preview button, you could easily rustle up a
little utility to kick the screensaver into life by broadcasting the
appropriate window message:
  Perform(WM_SYSCOMMAND, SC_SCREENSAVE, 0 );

HTH,

Conor



More information about the Delphi mailing list