How to detect that Windows is locked?

How to detect that Windows is locked (Win + L or screensaver locked)? Is it possible?

+6
source share
1 answer

There is no documented way to check if a session is locked. However, there is a way to detect that the session is being blocked. Use WTSRegisterSessionNotification (), you will receive a WM_WTSSESSION_CHANGE message with the value WTS_SESSION_LOCK when the workstation is locked.

If you plan to do this from a service, be sure to turn off β€œsession 0 session” to find out why this is not working.

+11
source

Source: https://habr.com/ru/post/904322/


All Articles