Private Const SPI_SETSCREENSAVEACTIVE = 17
Private 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
Public Function EnableScreenSaver(ByVal bStatus As Boolean) As Boolean
Dim lActiveFlag As Long
Dim lRetval As Long
lActiveFlag = IIf(bStatus, 1, 0)
lRetval = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, & _
lActiveFlag, 0, 0)
IF lRetval > 0 THEN
EnableScreenSaver = TRUE
ELSE
EnableScreenSaver = FALSE
END IF
End Function