VB6是以管理员身份运行的应用程序
有什么方法可以查明应用程序是否以管理员身份运行?
如果这涉及 COM 调用,我不会大惊小怪,任何有效的方法!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IsUserAnAdmin 是一个调用方便,并且在 VB6 程序中使用似乎非常可靠。看起来即使在Win8下也能正常工作。
请注意,它报告进程是否正在以管理员权限运行,而不是用户是否位于管理员组中。
以这种方式声明它应该可以一直工作到 Windows 2000:
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:
您可以使用
使用管理员 SID 的 CheckTokenMembership()
函数。我还没有尝试过从 VB 调用这个。(摘自Inno
IsAdminLoggedOn()
函数。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.