Is there any way of finding out if the application is running as administrator?
If this involves a COM call, I'm not really fussed, anything that works!
Is there any way of finding out if the application is running as administrator?
If this involves a COM call, I'm not really fussed, anything that works!
IsUserAnAdmin is an easy call and seems perfectly reliable for use in VB6 programs. It seems to work fine even in Win8.
Note that it reports whether the process is running with admin rights, not whether the user is in the Administrators group.
Declaring it this way it should work all the way back to Windows 2000:
Private Declare Function IsUserAnAdmin Lib "shell32" Alias "#680" () As Long
You can use the CheckTokenMembership()
function with the admin SID. I've not tried calling this from VB though.
(Taken from the Inno IsAdminLoggedOn()
function.