Older Version Newer Version

bshipps64 bshipps64 Feb 19, 2006 - "Edited description as per Alyce"

== IsUserAnAdmin() function ====IsUserAnAdmin() function== Determines whether the currently logged on user is a member of the Administrator's group. ---- > There are times when a program needs to perform an operation that requires the current user to have administrative privileges. This function uses a Shell32 API call to query as to whether the user is an administrator, returning 1 for true and 0 for false. This function requires Windows 2000 or higher. See [[bshipps64_Code_OSV|this page]] for an example on how to determine the operating system version. ---- [[code format="vbnet"]] isAdmin = IsUserAnAdmin() if not(isAdmin) then n$ = "not " print "Current user is "; n$; "an administrator" end function IsUserAnAdmin() calldll #shell32, "IsUserAnAdmin",_ IsUserAnAdmin as boolean end function [[code]] ---- Edited to add that the minimum OS for this API function is Windows 2000. It won't work on versions before that. [[user:Alyce]]