Get User Name

Wednesday, May 14, 2008

Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long
Public Property Get UserName() As Variant Dim sBuffer As String Dim lSize As Long sBuffer = Space$(255) lSize = Len(sBuffer) Call GetUserName(sBuffer, lSize) UserName = Left$(sBuffer, lSize) End Property

0 comments

Post a Comment