VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Find Windows UserName

by Ghaffar Nagafpour (5 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 6th August 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Find Windows UserName

API Declarations


'Email:[email protected]
'Location:Iran-Mazandaran-Tonekabon
'*****************************************

'Add 1CommandButton and 1Label to form


Private Declare Function GetUserNameA Lib "advapi32.dll" (ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetUserName() As String

Dim UN As String * 255
Call GetUserNameA(UN, 255)
GetUserName = Left$(UN, InStr(UN, Chr$(0)) - 1)
End Function



Rate Find Windows UserName



   Label1.Caption = GetUserName
End Sub



Download this snippet    Add to My Saved Code

Find Windows UserName Comments

No comments have been posted about Find Windows UserName. Why not be the first to post a comment about Find Windows UserName.

Post your comment

Subject:
Message:
0/1000 characters