Skip to content

Planet-Source-Code/mike-ejeet-9t9-getting-the-user-name__1-5044

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Getting the User Name

Description

By calling this function you can retrieve the current user name on that computer. Enjoy!

More Info

Submitted On
By Mike-Ejeet 9t9
Level Intermediate
User Rating 4.2 (161 globes from 38 users)
Compatibility VB 5.0, VB 6.0
Category Internet/ HTML
World Visual Basic
Archive File

Source Code

Place the following code into a module:
Private Declare Function GetUserName Lib "advapi32.dll" _
      Alias "GetUserNameA" (ByVal lpBuffer As String, _
      nSize As Long) As Long
Public Function UserName() As String
  Dim llReturn As Long
  Dim lsUserName As String
  Dim lsBuffer As String
  lsUserName = ""
  lsBuffer = Space$(255)
  llReturn = GetUserName(lsBuffer, 255)
  If llReturn Then
    lsUserName = Left$(lsBuffer, InStr(lsBuffer, Chr(0)) - 1)
  End If
  UserName = lsUserName
End Function

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published