引用 | 編輯
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系統使用者權限: 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 |