Home > How-To Library > System & API

How to Get Computer Name of the local computer.

**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * ****************************************************************
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

If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.