coredog
asked on
SystemParametersInfo() - Screensaver
I'd like to enable/disable and set the delay time for
the screensaver from a VB app. I'm using the following:
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, ByVal uParam _
As Long, ByRef lpvParam As Any, ByVal _
fuWinIni As Long) As Long
Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPI_SETSCREENSAVETIMEOUT = 15
Private Const SPI_GETSCREENSAVEACTIVE = 16
Private Const SPI_GETSCREENSAVETIMEOUT = 14
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
and calling SystemParametersInfo() like this:
SystemParametersInfo SPI_SETSCREENSAVEACTIVE, True, _
0, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
SystemParametersInfo SPI_SETSCREENSAVEACTIVE, False, _
0, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
to enable/disable, and like this:
SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, _
NewTime, 0, SPIF_SENDWININICHANGE Or _
SPIF_UPDATEINIFILE
where NewTime is a long containing the desired delay
in seconds, for setting the delay. Each call always
returns 0 and has no effect. Calling GetLastError()
immediately after each call always returns 0.
I'm using VB6 in Win98.
What am I missing?
the screensaver from a VB app. I'm using the following:
Private Declare Function SystemParametersInfo Lib _
"user32" Alias "SystemParametersInfoA" _
(ByVal uAction As Long, ByVal uParam _
As Long, ByRef lpvParam As Any, ByVal _
fuWinIni As Long) As Long
Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPI_SETSCREENSAVETIMEOUT = 15
Private Const SPI_GETSCREENSAVEACTIVE = 16
Private Const SPI_GETSCREENSAVETIMEOUT = 14
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
and calling SystemParametersInfo() like this:
SystemParametersInfo SPI_SETSCREENSAVEACTIVE, True, _
0, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
SystemParametersInfo SPI_SETSCREENSAVEACTIVE, False, _
0, SPIF_SENDWININICHANGE Or SPIF_UPDATEINIFILE
to enable/disable, and like this:
SystemParametersInfo SPI_SETSCREENSAVETIMEOUT, _
NewTime, 0, SPIF_SENDWININICHANGE Or _
SPIF_UPDATEINIFILE
where NewTime is a long containing the desired delay
in seconds, for setting the delay. Each call always
returns 0 and has no effect. Calling GetLastError()
immediately after each call always returns 0.
I'm using VB6 in Win98.
What am I missing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER