المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Check to se if user is logged on



C# Programming
06-18-2009, 07:00 PM
Hi I made a service that runs under the system account. The service gets a message from my server that tells it to shut down if no user is logged on. But because my service is run under system I can use this code to find out who is logged on.

string a;
a = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

I was wondering does any one know a different way to find if a user is logged on.