Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal Buffer As String, Size As Long) As Long
Sub Main()
Dim Buffer As String * 255
Dim Result As Long
Dim Length As Long
Length = 255
Result = GetComputerName(Buffer, Length)
If Length > 0 Then ComputerName = Left(Buffer, Length)
End Sub
|