Results 1 to 3 of 3

Thread: How do I find usernames?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Smile How do I find usernames?

    Does anyone know how to tell who's logged onto a windows NT environment, and how they wrote their username when they logged on?
    like you would have a listbox filled with usernames.
    and if they typed in: UsErNaMe it would say that instead of Username.
    Anyone.


    I haven't been able to get on in a while, the new webpage wouldn't work

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    VB Code:
    1. Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nsize As Long) As Long
    2.  
    3. Private Sub Command1_Click()
    4.     ' Display the name of the user currently logged on.
    5.     Dim username As String  ' receives name of the user
    6.     Dim slength As Long  ' length of the string
    7.     Dim retval As Long  ' return value
    8.    
    9.     ' Create room in the buffer to receive the returned string.
    10.     username = Space(255)  ' room for 255 characters
    11.     slength = 255  ' initialize the size of the string
    12.     ' Get the user's name and display it.
    13.     retval = GetUserName(username, slength)  ' slength is now the length of the returned string
    14.     username = Left(username, slength - 1)  ' extract the returned info from the buffer
    15.     ' (We subtracted one because we don't want the null character in the trimmed string.)
    16.     Text1.Text = username
    17. End Sub
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2001
    Posts
    18

    Unhappy No, that isn't exactly what I meant.

    I was referring to the other users on at the same time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width