Image credit: [**pixabay**]( Image credit: pixabay

VB6 reverse DNS

Note: This page was imported from a much older version of my site. The contents are still relevant but haven’t been changed in over five years. Please do us a favour and stop using VB6!

Looking up an IP from a hostname is fairly easy in Visual Basic but resolving IP addresses to hostnames isn’t. However, IN PTR DNS records can be retrieved using the Winsock APIs quite easily.

The example contains a simple project that simply shows how to call the function and how to handle errors.

Note: This code is for Visual Basic 6, not the more recent .NET versions


' Initialise Windows Sockets

' Attempt to get hostname
MsgBox GetHost("")

' Cleanup Windows Sockets

Download code

David Cannings
David Cannings
Cyber Security

My interests include computer security, digital electronics and writing tools to help analysis of cyber attacks.