Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleSee if a screen saver is running
DescriptionThis example shows how to see if a screen saver is running in Visual Basic 6. It uses the SystemParametersInfo API function.
Keywordsscreen saver, SystemParametersInfo
CategoriesSoftware Engineering
 
When a Timer fires, the program uses the SystemParametersInfo APi function to see if a screen saver is running and beeps if it is.
 
Private Declare Function SystemParametersInfo Lib "user32" _
    Alias "SystemParametersInfoA" (ByVal uiAction As Long, _
    ByVal uiParam As Long, pvParam As Any, ByVal fWInIni As _
    Long) As Boolean
Private Const SPI_GETSCREENSAVEACTIVE As Long = &H10
Private Const SPI_GETSCREENSAVERRUNNING As Long = &H72

Private Sub Timer1_Timer()
Dim is_running As Boolean

    SystemParametersInfo SPI_GETSCREENSAVERRUNNING, 0, _
        is_running, False
    If is_running Then Beep
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated