Notification of user unlocking screen?

  • Thread starter Thread starter Eddie Berman
  • Start date Start date
E

Eddie Berman

Does anyone know which notification is sent to a form or app when the user's
system's screen-saver mode ends - for example when the user re-logs in after
the machine has been in sleep mode?
I've been looking for any dotnet/win32 notification and am surprisingly
coming up empty handed.

Thanks much,
Ed
 
Does anyone know which notification is sent to a form or app when the user's
system's screen-saver mode ends - for example when the user re-logs in after
the machine has been in sleep mode?
I've been looking for any dotnet/win32 notification and am surprisingly
coming up empty handed.

Maybe you could log all messages your app receives with the program
Spy++ that comes with Visual Studio.
But I just tried that and it seems as if Spy++ is not able to 'spy' on
..NET-apps. So maybe you could create a simple unmanaged screensaver
app and 'spy' for the message.
Then you could handle it manually in the .NET-app.
Thanks much,
Ed

Just some ideas, because I will need that as well in a little while...
Please post a solution if you find one!


Thanks,
Henrik
 
Trapping Win + L won't catch every situation though (CTRL+ALT+DEL -> Lock
Workstation etc.)

How about something like listening out for WM_SYSCOMMAND SC_SCREENSAVE so
that you know you're in screen saver mode. Then just waiting for a
WM_MOUSEMOVE or WM_KEYDOWN to known you're leaving screensaver mode?

AndyC
 
Correct, I have previously read examples of periodically checking if the
Locked Desktop is loaded, such articles I have looked into are:

http://gethelp.devx.com/techtips/nt_pro/10_minute_solutions/10minNT0701.asp

I was personally unable to get the above solution to work correctly. Rather
you can use WndProc to check for the WM_SYSCOMMAND SC_SCREENSAVE messages,
however this will only work if the Window is currently active [not suitable
for many applications].

A suitable solution would be to create a Hook for such WM_GETMESSAGE
SC_SCREENSAVE messages. However I have posted my issues regarding a VB.NET
Hook under "Subject: Screensaver Event WM_GETMESSAGE Hook"

It would also be possible to load the screensaver timeout values [using
Windows.Management / WMI only Win2K and above] you could then create Hooks
for the Keyboard and Mouse events and operate the same as a screensaver,
using the same timeout. This is rather reinventing the wheel as you should
be able to hook the screensaver messages directly.

I have also read that hooking keyboard events can get you into trouble with
various virus scanning packages, so this also may not be the optimal solution.

I am also looking into a solution to capture the Windows acreensaver,
however I have yet to come up with an optimal solution within VB.NET

All help is appreciated and thank you in advance.
 
Back
Top