Computing.Net > Forums > Programming > VB get win2k current logged in user ??

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB get win2k current logged in user ??

Reply to Message Icon

Name: kayla
Date: April 4, 2002 at 14:50:12 Pacific
Comment:

Does someone know how to gain the current username from the user that is logged into a windows 2000 system. Can you do this with an API call?

Thanx..



Sponsored Link
Ads by Google

Response Number 1
Name: thomas mcarthur
Date: May 3, 2002 at 03:49:07 Pacific
Reply:

Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _
"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

Function fOSUserName() As String
' Returns the network login name
Dim lngLen As Long, lngX As Long
Dim strUserName As String
strUserName = String$(254, 0)
lngLen = 255
lngX = apiGetUserName(strUserName, lngLen)
If lngX 0 Then
fOSUserName = Left$(strUserName, lngLen - 1)
Else
fOSUserName = ""
End If
End Function


0

Response Number 2
Name: JF
Date: May 6, 2002 at 11:06:45 Pacific
Reply:

And how about getting the logged user on a remote machine???


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB get win2k current logged in user ??

Locally logged in user www.computing.net/answers/programming/locally-logged-in-user/10857.html

Get currently logged on username www.computing.net/answers/programming/get-currently-logged-on-username/13457.html

VB Registry question www.computing.net/answers/programming/vb-registry-question/9628.html