Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Screen Saver

Status
Not open for further replies.

gxdragon

Programmer
Feb 6, 2001
23
0
0
US
On my PC I had to disable my windows screen saver it kept shutting down VB6. Now the same thing is happening on a client site to a program I wrote. When power saver executes the program shuts down. Is there anything I can do besides disabling power saver?
 
Activate/Deactivate Screen Saver

With this source code you can activate/deactivate the screen saver. It's useful if you don't want that the screen saver will start running when your application is running. When the user close your application you can activate the screen saver again.

Form Code
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 ActivateScreenSaver(Active As Boolean) As Boolean

Dim retval As Long
Dim ActiveFlag As Long

ActiveFlag = IIf(Active, 1, 0)
retval = SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, ActiveFlag, 0, 0)
ActivateScreenSaver = retval > 0

End Function


Private Sub Form_Load()
'the line code below will deactivate the screen saver. if you want
'to activate the screen saver, change the 'False' below to 'True'
ActivateScreenSaver (False)
End Sub

Eric De Decker
vbg.be@vbgroup.nl

License And Copy Protection AxtiveX.

Download Demo version on my Site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top