判断XP系统使用者权限

Home Home
引用 | 编辑 sob790717
2010-11-07 11:15
楼主
推文 x0
该如何以VB6判断XP使用者是不是管理员还 ..

访客只能看到部份内容,免费 加入会员



献花 x0
引用 | 编辑 ebolaman
2010-11-09 19:37
1楼
  
这种要去 英文网站才能找到较丰富的资料


Binary World : http://binaryworld.net/Main/CodeDetail.aspx?CodeId=465



叙述:

This function will determine whether or not a thread is running in the user context of the local Administrator account. You need to examine the access token associated with that thread using the GetTokenInformation() API, since this access token represents the user under which the thread is running. By default the token associated with a thread is that of its containing process, but this user context will be superceded by any token attached directly to the thread. So to determine a thread's user context, first attempt to obtain any token attached directly to the thread with OpenThreadToken(). If this fails, and it reports an ERROR_NO_TOKEN, then obtain the token of the thread's containing process with OpenProcessToken().

献花 x2
引用 | 编辑 三仙
2010-11-09 21:31
2楼
  
下面是引用 sob790717 于 2010-11-07 11:15 发表的 判断XP系统使用者权限: 到引言文
该如何以VB6判断XP使用者是不是管理员还是 users?
并提示使用者请用管理员执行程式

这部分我不懂
找不到网上教学
请高手大大帮忙


Try it.
复制程式
Private Declare Function IsNTAdmin Lib "advpack.dll" _
(ByVal dwReserved As Long, ByRef lpdwReserved As Long) As Long
Private Sub Form_Load()
Dim blnAdmin As Boolean
blnAdmin = CBool(IsNTAdmin(ByVal 0&, ByVal 0&))
If Not blnAdmin = False Then MsgBox "Administrator rights."
End Sub


献花 x2