VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Get logged in username using GetUserName API

by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Fri 15th December 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Get logged in username using GetUserName API

Rate Get logged in username using GetUserName API



Dim cn As String
Dim ls As Long
Dim res As Long
cn = String(1024, 0)
ls = 1024
res = GetUserName(cn, ls)
If res <> 0 Then
MsgBox "You are logged in as " & " " & Mid(cn, 1, InStr(cn, Chr(0)) - 1)
Else
MsgBox "You are not logged in"
End If
End
End Sub


Download this snippet    Add to My Saved Code

Get logged in username using GetUserName API Comments

No comments have been posted about Get logged in username using GetUserName API. Why not be the first to post a comment about Get logged in username using GetUserName API.

Post your comment

Subject:
Message:
0/1000 characters