
SPI wount set!! please help!
Check the documentation on SystemParametersInfo.
First your example would turn it OFF. You need non-zero in the 2nd
argument to turn it ON. Secondly, SET operations require both
SPIF_UPDATEINIFILE and SPIF_SENDWININICHANGE flags in the fWinIni
argument for changes to take effect immediately and stick. Also note
that SPI_SETSCREENSAVEACTIVE will not run the screensavers immediately
(a common mis-conception). It merely enables them so they'll run
normally when the timeout expires.
Ex:
Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPIF_UPDATEINIFILE = &H1
Private Const SPIF_SENDWININICHANGE = &H2
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long,
lpvParam As Any, ByVal fuWinIni As Long) As Long
Usage:
lRet = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, 1&, ByVal 0&,
SPIF_UPDATEINIFILE Or SPIF_SENDWININICHANGE)
On Thu, 03 Jun 1999 11:16:08 +0200, BumbyBear
Quote:
>Why cant I set the screensaver timeout and active?
>I'v tried everything but can't get it to work.
>code:
>ret = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, False, vbNull, 0)
>It returns zero which should be an error. The spi_get action works fine
>but not the set ones...
>--
-Tom
(remove gibberish for e-mail repl)