I have a program that won't run if the screen saver is active. Is there a way to cause the screen saver to stop? I was thinking of sending a keystroke that would cause the screen saver to stop, but I wasn't sure if there was a better way.
Printable View
I have a program that won't run if the screen saver is active. Is there a way to cause the screen saver to stop? I was thinking of sending a keystroke that would cause the screen saver to stop, but I wasn't sure if there was a better way.
I found this...
Code:Private Const SPI_SETSCREENSAVEACTIVE = 17
Private Const SPI_GETSCREENSAVEACTIVE = 16
Private Const SPIF_SENDWININICHANGE = &H2
Private Const SPIF_UPDATEINIFILE = &H1
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
Function SetScreenSaverState(ByVal enabled As Boolean) As Boolean
' Enable or disable the screen saver
Dim fuWinIni As Long
SetScreenSaverState = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, enabled, _
ByVal 0&, fuWinIni) <> 0
End Function
Private Sub StopScreenSaver()
Call SetScreenSaverState(False)
End Sub
Hi
I am also looking for a piece of code which deacitivates Screen Saver through VB.
I tried the given code but it is still not deactivated. Please can anyone help on this ??