mj2008
mj2008

Reputation: 6747

How can I find the current DNS server?

I'm using Delphi and need to get the current Windows DNS server IP address so I can do a lookup. What function should I call to find it? The only solution I have right now does an ipconfig/all to get it, which is horrible.

Upvotes: 5

Views: 6124

Answers (3)

DeeCee
DeeCee

Reputation: 400

Found a nice one using the function GetNetworkParams().Seems to work quite good. You can find it here: http://www.swissdelphicenter.ch/torry/showcode.php?id=2452

Upvotes: 4

kender
kender

Reputation: 87131

Do you really need to know what is DNS server to do a lookup?

Here is a solution how to get a IP address using 2 functions: GetHostName and GetHostByName. I assume the GetHostByName function does the lookup you need for you, or am I wrong?

Upvotes: 1

Mladen Janković
Mladen Janković

Reputation: 8045

See GetNetowrkParams method (Platform SDK: IP Helper)

Upvotes: 0

Related Questions