Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages
Started by M J Heneghan
Thu, 10 Aug 2006 06:18
Screen Saver
Author: M J Heneghan
Date: Thu, 10 Aug 2006 06:18
Date: Thu, 10 Aug 2006 06:18
21 lines
1523 bytes
1523 bytes
I want to ensure the screensaver is turned off when running a demo video running under windows XP. At the beginning of the routine calling the demo I have added bool *IsScreenSave; SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, IsScreenSave, 0); SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, NULL, SPIF_SENDCHANGE); .... then call the demo using spawnl(P_WAIT, demo, demo, NULL); ... and at end of routine if (IsScreenSave) SystemParametersInfo(SPI_SCREENSAVEACTIVE, TRUE, NULL, SPIF_SENDCHANGE); however, the screensaver still kicks in. What am I missing? Thanks in advance. -- M J Heneghan.
Re: Screen Saver
Author: Remy Lebeau (TeamB)
Date: Thu, 10 Aug 2006 06:48
Date: Thu, 10 Aug 2006 06:48
26 lines
1886 bytes
1886 bytes
"M J Heneghan" <mjheneghan@ntlworld.com> wrote in message
news:44dacfb0$1@newsgroups.borland.com...
> bool *IsScreenSave;
> SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, IsScreenSave, 0);
That is not the correct way to pass the boolean. You have to use the '&'
operator instead:
BOOL IsScreenSave;
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &IsScreenSave, 0);
> however, the screensaver still kicks in.
As it should be. You are not preventing it from running at all.
SPI_SETSCREENSAVEACTIVE does not deactive the screensaver if it is already
running. It is only a flag to tell the OS whether the screensaver is
running or not. Screensavers use SPI_SETSCREENSAVEACTIVE when they run. If
anything, you should be setting SPI_SETSCREENSAVEACTIVE to TRUE instead of
FALSE to trick the OS into thinking a screensaver is running when none
actually is. That way, the actual screen saver will not kick in until you
set SPI_SETSCREENSAVEACTIVE back to FALSE later.
Gambit
Re: Screen Saver
Author: M J Heneghan
Date: Thu, 10 Aug 2006 14:47
Date: Thu, 10 Aug 2006 14:47
34 lines
2179 bytes
2179 bytes
Thanks for the information. I have a lot to learn! "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:44dae467$1@newsgroups.borland.com... > > "M J Heneghan" <mjheneghan@ntlworld.com> wrote in message > news:44dacfb0$1@newsgroups.borland.com... > >> bool *IsScreenSave; >> SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, IsScreenSave, 0); > > That is not the correct way to pass the boolean. You have to use the '&' > operator instead: > > BOOL IsScreenSave; > SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &IsScreenSave, 0); > >> however, the screensaver still kicks in. > > As it should be. You are not preventing it from running at all. > SPI_SETSCREENSAVEACTIVE does not deactive the screensaver if it is already > running. It is only a flag to tell the OS whether the screensaver is > running or not. Screensavers use SPI_SETSCREENSAVEACTIVE when they run. > If > anything, you should be setting SPI_SETSCREENSAVEACTIVE to TRUE instead of > FALSE to trick the OS into thinking a screensaver is running when none > actually is. That way, the actual screen saver will not kick in until you > set SPI_SETSCREENSAVEACTIVE back to FALSE later. > > > Gambit > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads