[RESOLVED] Current User Loged In
I know you did this onece befor but i cant find that post anymore.
Is there a auto trim on these forms?
Anyways.. I got this as code but its not displaying the current user loged into windows.
VB Code:
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub Form_Load()
Message.Caption = "Welcome " & CurrentUser
End Sub
Re: Current User Loged In
Re: [RESOLVED] Current User Loged In
VB Code:
Private Sub Form_Load()
Dim sBuffer As String * 255
GetUserName sBuffer, Len(sBuffer)
Debug.Print Left$(sBuffer, InStr(sBuffer, vbNullChar) - 1)
End Sub
Re: [RESOLVED] Current User Loged In
You can achive this also like this:
VB Code:
MsgBox Environ("USERNAME")