rettiseert
asked on
detect screensaver in vb.net
Hi
I'm using VB.NET 2008 & WinForms. I need a function that returns True if the system screensaver is running.
I have tried this:
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
Public Shared Function IsScreenSaverRunning() As Boolean
Dim Running As Integer
Const SPI_GETSCREENSAVEACTIVE As Integer = 16
SystemParametersInfo(SPI_G ETSCREENSA VEACTIVE, 0, Running, 0)
Return Running
End Function
But SystemParametersInfo returns an error value and after callin GetLastError I ger error 998 (Invalid access to memory location).
I guess the problem is with the API calling / passing parameters.
Any ideas?
Thanks
I'm using VB.NET 2008 & WinForms. I need a function that returns True if the system screensaver is running.
I have tried this:
Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Integer, ByVal uParam As Integer, ByVal lpvParam As Integer, ByVal fuWinIni As Integer) As Integer
Public Shared Function IsScreenSaverRunning() As Boolean
Dim Running As Integer
Const SPI_GETSCREENSAVEACTIVE As Integer = 16
SystemParametersInfo(SPI_G
Return Running
End Function
But SystemParametersInfo returns an error value and after callin GetLastError I ger error 998 (Invalid access to memory location).
I guess the problem is with the API calling / passing parameters.
Any ideas?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER