Activating the Screensaver

PWNettle
05-24-2000, 12:39 PM
Does anyone know how to activate the windows screensaver via VB? I'm thinking there must be an API call for this but I'm just starting with API and don't really know much yet.

Thanks,
Paul

Ryo2
02-21-2002, 07:27 PM
In module(.bas)

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, ByVal lpvParam As Long, ByVal fuWinIni As Long) As Long

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

--------------------------------------------
So in your FORM(.frm):
ToggleScreenSaverActive(True) to Activate
ToggleScreenSaverActive(False) to Disable

Thinker
02-21-2002, 08:15 PM
I'm not sure trying to answer posts almost 2 years old is going
help much. ;)

Ryo2
02-21-2002, 08:30 PM
Doh!

usetheforce2
02-24-2002, 01:54 PM
Ryo2 is just a devoted helper :)

Laurent
02-25-2002, 06:08 AM
paul was asking questions? i'm surprised...:D

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum