Advertisement
7_2009-2012 Windows API Call/ Explanation #217356

Get User Name

Returns the current user name using a dll call

AI

AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

소스 코드
original-source
Function GetUser()
 ' This function uses a windows dll to query the registry automatically ti return the user name
 Dim sBuffer As String
 Dim lSize As Long
 ' Parameters for the dll declaration are set
 sBuffer = Space$(255)
 lSize = Len(sBuffer)
 Call GetUserName(sBuffer, lSize)   ' Call the declared dll function
If lSize > 0 Then
 GetUser = Left$(sBuffer, lSize)   ' Remove empty spaces
Else
 GetUser = vbNullString   ' Return empty if no user is found
End If
End Function
Upload
Upload
원본 댓글 (3)
Wayback Machine에서 복구됨