CodeItBetter Programming Another VB Programming Blog

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:

  1. How to get User’s local information
  2. How to get the remote computer name from IP address and How to get the remote system IP address from computer name
  3. How to get all local drives
  4. How to Get current user Name (in three ways)
  5. How to get current directory using API
  6. How to List Network Computers
  7. How to detect if a computer has a sound card that plays Wave Audio.
  8. How to Get the Windows System Directory
  9. How to get GMT time from local system time
  10. How to return the create date/time, last accessed date/time, last modified date/time of a given file

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.