Link to home
Start Free TrialLog in
Avatar of cskiong
cskiongFlag for Malaysia

asked on

Detecting Screen saver running, desktop lock and unlock event

Hi Experts,

Is there a way to detect the following event on windows?
1. Screen saver starts running (due to idle).
2. Computer lock (User locks computer by Ctrl+Alt+Del or [Windows] key + L)
3. Resume from screen saver or computer lock.

Thank you
Avatar of gtworek
gtworek
Flag of Poland image

ad 1)
You can use SystemParametersInfo with the SPI_GETSCREENSAVERRUNNING flag
This should get you going: http://dotnet.sys-con.com/node/105651
David
ASKER CERTIFIED SOLUTION
Avatar of cskiong
cskiong
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I do not know the situation in your system but you can always write your own screen saver and send kind of message from it. But this will work only in your own environment.
I've got better screensaver start detection: trap messages and when screensaver is started there is WM_SYSCOMMAND with SC_SCREENSAVE sent by the system.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial