VBGamer |
|
Disabling Screensaver -- code Jay Wheeler (0 replies, 0 views) (2000-Sep-6) I finally figured out how to do this. The problem I had before was that the function posted on lots of websites was being overruled by Patrice Scribe's WIN32 TLB -- so unload the TLB before you try to get this to work, if you're using it.
Declare these somewhere:
---------------
Public Const SPI_SETSCREENSAVEACTIVE = 17
Public Declare Function SystemParametersInfo Lib "user32" _
Alias "SystemParametersInfoA" (ByVal uAction As Long, ByVal _
uParam As Long, ByVal lpvParam As Long, ByVal fuWinIni As _
Long) As Long
---------------
Then use this function:
---------------
Public Function ToggleScreenSaverActive(Active As Boolean) _
As Boolean
'To Activate Screen Saver, set active to true
'to deactivate, set active to false
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
--------------- |