|
-
July 22nd, 1999, 05:43 AM
#1
LogonUser
How do I use LogonUser (win32 api) together with vb.
The following is the problem, they are constants and how do I get those constants to work with VB?
DWORD dwLogonType, //
DWORD dwLogonProvider, //
-
July 22nd, 1999, 06:13 AM
#2
Re: LogonUser
use the API Viewer add-in to get those constants in VB syntax.
I did it for you:
Public Const LOGON32_LOGON_INTERACTIVE = 2
Public Const LOGON32_PROVIDER_WINNT35 = 1
-
July 22nd, 1999, 08:22 AM
#3
Re: LogonUser
Thanks! But why doesn't it work (login failed)??
the code is under a command_button in a form with nothing else...
the domain, pwd and user is correct (string type).
Dim TokenHandle as Long
Dim lstatus as Long
lstatus = LogonUser("user", "domain", "pwd", LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, TokenHandle)
If lstatus then
lstatus = CloseHandle(TokenHandle)
MsgBox "Login Successful"
else
MsgBox "Login Failed"
End If
-
July 22nd, 1999, 11:38 AM
#4
Re: LogonUser
always call FormatMessage and pass the err.lastDLLerror to get a readable description of the reason of your error
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|