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 -----Original Message----- From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On Behalf Of John Bird Sent: Wednesday, 10 June 2009 3:38 p.m. To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Detecting screensaver I have seen that variant, but from what I saw this detects the screensaver is set, not that it is active? >From the D7 win32 help: "SPI_GETSCREENSAVEACTIVE Determines whether screen saving is enabled. The pvParam parameter must point to a BOOL variable that receives TRUE if enabled, or FALSE otherwise." In my tests the above always returns true, as I do have a screen saver enabled, and it does not return a changing status if the screen saver is on at the moment or not. (I was using the control panel screen saver preview button to check this). I am trying to detect if a screensaver is currently actually running John > I'm using SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, > @ATScreenSaverOn, 0); It works on Vista here > > Paul > > ----- Original Message ----- > From: "John Bird" <johnkb...@paradise.net.nz> > To: "NZ Borland Developers Group - Delphi List" <delphi@delphi.org.nz> > Sent: Tuesday, June 09, 2009 7:30 AM > Subject: [DUG] Detecting screensaver > > >> Does anyone know a reliable way to detect if the screensaver is on? >> The way I have found references to on the web >> >> SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, @ATScreenSaverOn, >> 0); >> >> Note this is documented as Windows 95 only, which I am guessing why >> it doesn't work (XP/Vista) >> >> The only other way I can think of is to try to find the full name of >> the foreground program and see if it has a .SCR extension, but I am >> not confident that would work. >> >> John >> >> _______________________________________________ >> NZ Borland Developers Group - Delphi mailing list >> Post: delphi@delphi.org.nz >> Admin: http://delphi.org.nz/mailman/listinfo/delphi >> Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: >> unsubscribe >> >> > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: > unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe