VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get the username of a logged use in a domain

by Waty Thierry (60 Submissions)
Category: Windows System Services
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 13th April 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get the username of a logged use in a domain

Rate Get the username of a logged use in a domain




Public Function NetWorkUser() As String
   ' #VBIDEUtils#************************************************************
   ' * Programmer Name  : Egbert Nierop
   ' * Web Site         : www.geocities.com/ResearchTriangle/6311/
   ' * E-Mail           : [email protected]
   ' * Date             : 1/02/99
   ' * Time             : 09:51
   ' * Procedure Name   : NetWorkUser
   ' * Parameters       :
   ' **********************************************************************
   ' * Comments         : It is possible to use the fact that
   ' *    a user has already logged on to a domain and has a
   ' *    Windows user name
   ' *
   ' *
   ' **********************************************************************
   
   Static strUser As String
   
   If Len(strUser) Then
      NetWorkUser = strUser
      Exit Function
   End If
   
   Dim lpUserName As String * 64
   
   If Wnetgetuser("", lpUserName, Len(lpUserName)) Then
      strUser = CurrentUser()
   Else
      strUser = Left(lpUserName, InStr(lpUserName, Chr(0)) - 1)
   End If
   
   NetWorkUser = strUser
   
End Function




Download this snippet    Add to My Saved Code

Get the username of a logged use in a domain Comments

No comments have been posted about Get the username of a logged use in a domain. Why not be the first to post a comment about Get the username of a logged use in a domain.

Post your comment

Subject:
Message:
0/1000 characters