Obtaining Host name through windows networking

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-05-01
In VB 6 how can I get the host name (computer name in windows networking) from the IP address?
Question by:belcalan
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 18

Accepted Solution

bobbit31 earned 100 total points
ID: 7985135

Expert Comment

ID: 7985282

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.

Author Comment

ID: 7990343
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.

Author Comment

ID: 7990444
Not actually the right answer, but the link to the right answer was on that page so thanks anyway!

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question