G
Guest
Hi
I am using the code below to enable and disable the screen saver.It all
works fine with win98 and win 2000 but it is not working for Win XP.What
could be the problem.
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal
lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_SETSCREENSAVEACTIVE = 17
Public Function ToggleScreenSaverActive(Active As Boolean) As Boolean
Dim lActiveFlag As Long
Dim retvaL As Long
lActiveFlag = IIf(Active, 1, 0)
retvaL = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0)
ToggleScreenSaverActive = retvaL > 0
End Function
Private Sub Command1_Click()
ToggleScreenSaverActive (False)
End Sub
Private Sub Command2_Click()
ToggleScreenSaverActive (True)
End Sub
With Thanks
Sridhar
I am using the code below to enable and disable the screen saver.It all
works fine with win98 and win 2000 but it is not working for Win XP.What
could be the problem.
Option Explicit
Private Declare Function SystemParametersInfo Lib "user32" Alias
"SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, ByVal
lpvParam As Any, ByVal fuWinIni As Long) As Long
Private Const SPI_SETSCREENSAVEACTIVE = 17
Public Function ToggleScreenSaverActive(Active As Boolean) As Boolean
Dim lActiveFlag As Long
Dim retvaL As Long
lActiveFlag = IIf(Active, 1, 0)
retvaL = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, lActiveFlag, 0, 0)
ToggleScreenSaverActive = retvaL > 0
End Function
Private Sub Command1_Click()
ToggleScreenSaverActive (False)
End Sub
Private Sub Command2_Click()
ToggleScreenSaverActive (True)
End Sub
With Thanks
Sridhar