I know how to look up a hostname from IPv4 to VB using the Windows API call GetHostByAddr ( this works fine). However, this feature does not allow you to specify the DNS server to use. Sometimes DNS servers are fine by default, but in other cases I need to specify an external DNS server for searching, and I donโt think that making an nslookup shell and analyzing the output is the best method here.
Note: in fact, it will be used as VBA code in an Excel workbook to help someone else do their job, and itโs not worth writing a large application when it needs only simple functionality.
I thought I might have found the answer in the getnameinfo API call , but it seems that a thorough reading indicates that it does not offer the servername parameter.
After some intensive searching, I found a link to the pExtra parameter to the DNSQuery function . But I donโt even know how to start using this in VB6.
Can someone help me somehow do a DNS lookup from VB6 by specifying the server name to use?
A complete working solution, of course, would be nice, but I'm ready to work: just point me in the right direction.
UPDATE: For some odd reason, he did not click that DNSQuery was a call to the Windows API. It just doesn't seem like one. Of course, I could have made more progress on this issue if I had gathered this small detail.
ErikE source share