Obtaining Host name through windows networking

In VB 6 how can I get the host name (computer name in windows networking) from the IP address?
Who is Participating?

Try this Little Program:
On your Form put a:
1 Command Button
1 Label

Create a Module in on Project.
Put the Code: in your form
Put the Module in your Module


Private Sub Command1_Click()
      Dim Ret As Long
      Dim Buffer As String
      Dim NomePc
      Buffer = Space(255)
      Ret = GetComputerName(Buffer, Len(Buffer))
      NomePc = Left(Buffer, Len(Buffer))
      Label1 = NomePc
End Sub


Public Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long

That's it.
Hope it Suites you.
belcalanAuthor Commented:
Close guys, but what I need is the ability to get the host name of *other* computers given the ip address.  GetComputerName & getIPHostName only give me the name of the current host.
belcalanAuthor Commented:
Not actually the right answer, but the link to the right answer was on that page so thanks anyway!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.