UserName – The name of the interactive user

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _    (ByVal lpBuffer As String, nSize As Long) As Long' The name of the interactive userFunction UserName() As String    Dim buffer As String * 512, length As Long    length = Len(buffer)    If GetUserName(buffer, length) Then        ' returns non-zero if successful, and modifies the length argument        UserName = Left$(buffer, length - 1)    End IfEnd Function

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


Recent Articles: