How to Get Computer Name of the local computer.
Posted on January 4, 2009
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 |
Related posts:
- How to get User’s local information
- How to get the remote computer name from IP address and How to get the remote system IP address from computer name
- How to get all local drives
- How to Get current user Name (in three ways)
- How to get current directory using API
- How to List Network Computers
- How to detect if a computer has a sound card that plays Wave Audio.
- How to Get the Windows System Directory
- How to get GMT time from local system time
- How to return the create date/time, last accessed date/time, last modified date/time of a given file