VB6 is application running as administrator

2019-06-28 08:28发布

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!

2条回答
\"骚年 ilove
2楼-- · 2019-06-28 08:31

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.

查看更多
一夜七次
3楼-- · 2019-06-28 08:43

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
查看更多
登录 后发表回答