Checking for workstation lock/unlock change with c#

前端 未结 4 1733
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-09 22:27

DUPLICATE: How can I programmatically determine if my workstation is locked?

How can I detect (during runtime) when a Windows user has locked their

4条回答
  •  我在风中等你
    2020-12-09 22:31

    You can get this notification via a WM_WTSSESSION_CHANGE message. You must notify Windows that you want to receive these messages via WTSRegisterSessionNotification and unregister with WTSUnRegisterSessionNotification.

    These posts should be helpful for a C# implementation.

    http://pinvoke.net/default.aspx/wtsapi32.WTSRegisterSessionNotification

    http://blogs.msdn.com/shawnfa/archive/2005/05/17/418891.aspx

    http://bytes.com/groups/net-c/276963-trapping-when-workstation-locked

提交回复
热议问题