50% OFF* an Expert Office® subscription.*Discount applies to first charge of a new subscription only.
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Public Class Form1
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, _
ByVal uParam As Integer, ByRef lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim SPI_GETSCREENSAVERRUNNING As Integer = 114
Dim screenSaverRunning As Integer = -1
Dim ok As Integer = SystemParametersInfo(SPI_GETSCREENSAVERRUNNING, 0, screenSaverRunning, 0)
If ok = 0 Then
Debug.Write("Failed" & vbCrLf)
ElseIf (screenSaverRunning = 0) Then
Debug.Write("Screensaver OFF" & vbCrLf)
Debug.Write("Screensaver ON" & vbCrLf)
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Open in new window
From novice to tech pro — start learning today.
Members can enroll in this course at no extra cost.