Hook windows logon/logoff events

ぃ、小莉子 提交于 2019-12-04 22:23:24

I am unfamiliar with Delphi's implementation of Windows services but wherever you set the controls accepted by the service you should add SERVICE_ACCEPT_SESSIONCHANGE. Then in your HandlerEx callback function the dwEventType parameter will be one of the WM_WTSSESSION_CHANGE values and the lpEventData will be a pointer to a WTSSESSION_NOTIFICATION structure that contains the session ID of the event.

You can use this info along with the terminal services API to determine who did what.

You can use SENS to listen to subscribe to log-in notifications.

You need to be more specific in your requirements. There may be multiple users logged on at any given time, either locally or remotely. Do you only care about interactive users?

The most common request is how to get the locally logged-on interactive user, i.e. the person who is physically sat at the keyboard and screen. There are various issues that you must consider before you decide how to proceed. MSDN has a good entry on Window Stations that will explain the situation better than I can.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!