PDA

Vollständige Version anzeigen : Windows PC Namen von NT/2K/XP auslesen


T-Bone
16.12.2004, 13:30
Private Declare Function GetComputerName Lib "kernel32" _
Alias "GetComputerNameA" (ByVal Name As String, _
ByRef BufSize As Long) As Long
Private Const MAX_COMPUTERNAME_LENGTH As Long = 16

Public Function Hostname() As String
Dim Name As String
Dim Anz As Long
Anz = MAX_COMPUTERNAME_LENGTH
Name = Space(MAX_COMPUTERNAME_LENGTH)
GetComputerName Name, Anz
Name = Left(Name, Anz)
Hostname = Name
End Function