jasontektips
Programmer
Hi,
I'm trying out the LogonUser function of ADVAPI32.dll with a simple VB program, but it always return me FALSE. The following is the code:
____________________________________________________
Option Explicit
Private Declare Function LogonUser Lib "Advapi32.dll" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long
Private Sub cmdTestPassword_Click()
Dim phToken As Long
If LogonUser("jasonID", _
"jasonDomain", _
"jasonPassword", _
3, _
0, _
phToken) = 0 Then
MsgBox ("Wrong Password!!!"
Else
MsgBox ("Correct Password!!!"
End If
End Sub
____________________________________________________
I've tried to create the ID:jasonID with the appropriate password in both local machine as well as the Domain Controller, but all return me FALSE.
Can someone help to rectify this.
Many Thanks
Jason
I'm trying out the LogonUser function of ADVAPI32.dll with a simple VB program, but it always return me FALSE. The following is the code:
____________________________________________________
Option Explicit
Private Declare Function LogonUser Lib "Advapi32.dll" Alias "LogonUserA" (ByVal lpszUsername As String, ByVal lpszDomain As String, ByVal lpszPassword As String, ByVal dwLogonType As Long, ByVal dwLogonProvider As Long, phToken As Long) As Long
Private Sub cmdTestPassword_Click()
Dim phToken As Long
If LogonUser("jasonID", _
"jasonDomain", _
"jasonPassword", _
3, _
0, _
phToken) = 0 Then
MsgBox ("Wrong Password!!!"
Else
MsgBox ("Correct Password!!!"
End If
End Sub
____________________________________________________
I've tried to create the ID:jasonID with the appropriate password in both local machine as well as the Domain Controller, but all return me FALSE.
Can someone help to rectify this.
Many Thanks
Jason