Hi All,
Quick question, I manage to come up with a working code the
successfully checks if the current users is part of the Administrators
group or not. My question is, will this code work from Windows 95? 98?
ME? 2000?
My development machine is currently XP, and it works fine here.
Thanks in advance,
Henry :)
Private Function CheckAdministra torRole() As Boolean
On Error Resume Next
System.AppDomai n.CurrentDomain .SetPrincipalPo licy(Security.P rincipal.Princi palPolicy.Windo wsPrincipal)
Dim prpAdministrato r As New
System.Security .Permissions.Pr incipalPermissi on(Environment. UserName,
"BUILTIN\Admini strators")
prpAdministrato r.Demand()
If Err.Number <> 0 Then
CheckAdministra torRole = True
Else
CheckAdministra torRole = False
End If
End Function
Quick question, I manage to come up with a working code the
successfully checks if the current users is part of the Administrators
group or not. My question is, will this code work from Windows 95? 98?
ME? 2000?
My development machine is currently XP, and it works fine here.
Thanks in advance,
Henry :)
Private Function CheckAdministra torRole() As Boolean
On Error Resume Next
System.AppDomai n.CurrentDomain .SetPrincipalPo licy(Security.P rincipal.Princi palPolicy.Windo wsPrincipal)
Dim prpAdministrato r As New
System.Security .Permissions.Pr incipalPermissi on(Environment. UserName,
"BUILTIN\Admini strators")
prpAdministrato r.Demand()
If Err.Number <> 0 Then
CheckAdministra torRole = True
Else
CheckAdministra torRole = False
End If
End Function
Comment