
How do I use Logonuser API in VB?
Does anyone have a working example in VB 5.0 of how to use Logonuser
API?
I tried the following, but id doesnt work.
Declared in Module1.bas:
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
in the load of form1:
Dim Username As String, Domain As String
Dim Password As String, Type1 As Long
Dim Provider As Long, token As Long
Dim x As Long
Username = "Steve"
Domain = "stars"
Password = "miller"
Type1 = 0
Provider = 0
token = 0
x = LogonUser(Username, Domain, Password, Type1, Provider, token)
X comes back as 0, which means it was unsuccessful.
I even tried using "\\stars" for the domain and still get 0 for X.
Can anyone provide a working example?
Thanks!
Steve Miller