|
-
Sep 19th, 2001, 08:37 PM
#1
Thread Starter
New Member
How do I get current user name and domain?
In ASP we can get the user by this:
sUser=Request.ServerVariables("AUTH_USER")
But how do I get the user in VB?
I have used the API Function,
Private Declare Function w32_WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA" (ByVal lpName As String, ByVal lpUserName As String, lpnLength As Long) As Long
but this only gets the user name.
I want the domain and username (<domain>\<username>)
Any suggestions?
Vone
-
Sep 19th, 2001, 11:27 PM
#2
Thread Starter
New Member
Found solution
VB Code:
Dim WinNTSysInfo As WinNTSysInfo
set WinNTSysInfo = New WinNTSysInfo
Debug.Print WinNTSysInfo.DomainName
Debug.Print WinNTSysInfo.UserName
-
Sep 20th, 2001, 12:01 AM
#3
Frenzied Member
or use the the "Environ" Function.
VB Code:
MsgBox Environ("USERDOMAIN")
MsgBox Environ("USERNAME")
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
|