Perform Task Just Before Windows Lockout
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 开发者_如何学Gopunch 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!
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?
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.
精彩评论