判斷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