Results 1 to 2 of 2

Thread: Domain UserName

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2000
    Location
    Rafaela (Argentine)
    Posts
    107

    Question

    I'm working in a NT domain, from a PC running Windows 9x. How can I know the user currently logged in?
    Thanks in advance

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Here you go:
    Code:
    Option Explicit
    Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
    
    
    Private Sub Command1_Click()
        Dim strBuffer As String
        
        strBuffer = Space(125)
        If GetUserName(strBuffer, Len(strBuffer)) Then
            MsgBox Left(strBuffer, InStr(strBuffer, vbNullChar) - 1)
        End If
    End Sub

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