All pastes #966462 Raw Edit

User info

public text v1 · immutable
·published 2008-04-01 19:22 UTC
rendered paste body
Attribute VB_Name = "UserInfo"
'Avoir le nom de l'utilisateur
Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

'Avoir le nom de l'ordinateur
Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" ( _
                 ByVal lpBuffer As String, nSize As Long) As Long


'Retourne le nom de l'ordinateur
Public Function ComputerName() As String
Dim stTmp As String, lgTmp As Long
stTmp = Space$(250)
lgTmp = 251
Call GetComputerName(stTmp, lgTmp)
ComputerName = Split(stTmp, Chr$(0))(0)
End Function