tags:

views:

34

answers:

2

Hey All,

I'm wondering if there is a way to intercept that a Windows session is about to be locked and essentially provide a pop-up just before. We've got an intranet punch in/out facility, and many people forget to punch in or out before leaving for lunch or for the day. Essentially I'm looking for a way to give the users the option to log out when they lock their machines.

I am also completely open to the possibility that this may not be possible due to security concerns, but I wanted to see what the community's take on it was anyway. Thanks!

+2  A: 

Haven't tried it, but the Microsoft.Win32.SystemEvents class might have what you want.

Specifically, you may want to try the SessionSwitch event. According to this bytes.com post, it should work:

Handle the Windows Lock Desktop event/message?

Adam Neal
Thanks for the answer Adam. From what I've found, the only similar event is the session ending event, which unfortunately is not triggered by a session lock.
DJ Quimby
Sounds like `SessionSwitch` may work - updated the answer.
Adam Neal
That looks promising, thanks!
DJ Quimby
+1  A: 

You can use the Remote Desktop Services API WTSRegisterSessionNotification to get lock notifications, but there doesn't appear to be any way to override the lock.

Luke