> > how can I know that the option of "Obtain DNS server address > > automatically" in Internet Protocol(TCP\IP) property have be set or > > checked by coding ? I need to judge it and change "Obtain DNS server > > address > > automatically" to "Use the following DNS server addresses"; > > Are there any api or other methods to get it? AliR (VC++ MVP) wrote: > You can call GetAdaptersInfo(...). The DhcpEnabled member of > IP_ADAPTER_INFO tells you if DHCP is enabled or not. > AliR. AliR Thank your reply.but if DHCP is enabled or not is not what I want to care. If DHCP is enabled or not only can tell that "Obtain an IP address automatically" has been checked. It have been known by me. I only want to know whether the option of "Obtain DNS server address automatically" have been set or not?How to know it.
You are right my ealier suggestion wasn't very helpful. I went digging around in the registry. I traced the changes to the network settings to this key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interf aces Under this key are a bunch of adapter ids. Under each adapter id are the settings. If the value of NameServer is blank then it mean that Find DNS server automatically is set, if it has a value then its not set and the address(s) are there. Doing a search on the key got this site http://support.microsoft.com/kb/314053 AliR. "flyingco" <zhouyou3000@gmail.com> wrote in message news:1161741376.932773.52100@i42g2000cwa.googlegroups.com... > > > how can I know that the option of "Obtain DNS server address > > > automatically" in Internet Protocol(TCP\IP) property have be set or > > > checked by coding ? I need to judge it and change "Obtain DNS server > > > address > > > automatically" to "Use the following DNS server addresses"; > > > Are there any api or other methods to get it? > > > > > AliR (VC++ MVP) wrote: > > You can call GetAdaptersInfo(...). The DhcpEnabled member of > > IP_ADAPTER_INFO tells you if DHCP is enabled or not. > > > AliR. > > > > > AliR > Thank your reply.but if DHCP is enabled or not is not what I want to > care. > If DHCP is enabled or not only can tell that "Obtain an IP address > automatically" has been checked. It have been known by me. > I only want to know whether the option of "Obtain DNS server address > automatically" have been set or not?How to know it. >
AliR (VC++ MVP) wrote: > You are right my ealier suggestion wasn't very helpful. > > I went digging around in the registry. I traced the changes to the network > settings to this key > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interf > aces > > Under this key are a bunch of adapter ids. Under each adapter id are the > settings. If the value of NameServer is blank then it mean that Find DNS > server automatically is set, if it has a value then its not set and the > address(s) are there. > > Doing a search on the key got this site > http://support.microsoft.com/kb/314053 > > AliR. > > "flyingco" <zhouyou3000@gmail.com> wrote in message > news:1161741376.932773.52100@i42g2000cwa.googlegroups.com... > > > > how can I know that the option of "Obtain DNS server address > > > > automatically" in Internet Protocol(TCP\IP) property have be set or > > > > checked by coding ? I need to judge it and change "Obtain DNS server > > > > address > > > > automatically" to "Use the following DNS server addresses"; > > > > Are there any api or other methods to get it? > > > > > > > > > > AliR (VC++ MVP) wrote: > > > You can call GetAdaptersInfo(...). The DhcpEnabled member of > > > IP_ADAPTER_INFO tells you if DHCP is enabled or not. > > > > > AliR. > > > > > > > > > > AliR > > Thank your reply.but if DHCP is enabled or not is not what I want to > > care. > > If DHCP is enabled or not only can tell that "Obtain an IP address > > automatically" has been checked. It have been known by me. > > I only want to know whether the option of "Obtain DNS server address > > automatically" have been set or not?How to know it. > > AliR Thank you very much! I have done it like you ever,but don't find the exact evidence to get it. but you have finished it very good .