Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base

Post new topic   Reply to topic
Disable The Screen Saver
View previous topic :: View next topic  
Author Message
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Oct 10th, 2003 07:54 AM    Post subject: Disable The Screen Saver Reply with quote

Code:
'Author: Waty Thierry
'Origin: [url]http://www.geocities.com/ResearchTriangle/6311/[/url]
'Purpose: Activate/Deactivate the Screen Saver
'Version: VB4+

Option Explicit
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

Private Sub Form_Load()
ToggleScreenSaverActive False
End Sub

Private Sub Form_Unload(Cancel As Integer)
ToggleScreenSaverActive True
End Sub

_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Knowledge Base All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic