zhoumy博客(C#、Windows Phone XAML)

C#:判断当前程序是否通过管理员运行

public bool IsAdministrator()
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}

 

 

转载声明:本文转载至http://www.zhoumy.cn/?id=4

posted @ 2014-11-07 15:06  zhoumy  阅读(523)  评论(0编辑  收藏  举报
zhoumy博客(C#、Windows Phone XAML)