how to identify logon event in window service

后端 未结 3 472
醉酒成梦
醉酒成梦 2021-01-16 14:50

i have a windows service that get user details and save the result into log text file. and, my problem is when i log off my system and login again ie without restarting the

3条回答
  •  半阙折子戏
    2021-01-16 15:30

    http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicebase.onsessionchange.aspx

    This may be your best bet, as Vista and Win7 handle the user sessions much like a terminal server would. This should let you handle session changes and it gives a structure with the relevant information, if you want session ID or reason for session change (logon / logoff / lock etc)

提交回复
热议问题