How to Get Computer Name of the local computer.
Posted on August 6, 2011
1 2 3 4 5 6 7 8 9 10 11 12 | 'System & API - How to Get Computer Name of the local computer. Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" _ (ByVal lpBuffer As String, nSize As Long) As Long Function ComputerName() As String Dim buffer As String * 512, length As Long length = Len(buffer) 'GetComputerName returns zero on failure If GetComputerName(buffer, length) Then ComputerName = Left$(buffer, length) End If End Function |