title: How to modify dns server in C++?
body: <p>I want to change the primary dns server to some ip(e.g. 8.8.8.8), for all active adapters.  </p>
  
  <p>I tried to modify the registry, for all interfaces under <code>HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters</code>, the <code>NameServer</code> is changed to what i want.  </p>
  
  <p>However it doesn't work. <code>ipconfig /all</code> shows that the dns is changed, however the system seems didn't apply that. If I open the attribute of <code>TCP/IPv4</code>, the dns is already changed, then i click <code>OK</code>, until now the dns is put into use.</p>
  
  <p>Could someone tell me how to solve this? you may go some other ways, besides registry.  </p>
  
  <p>Update: what i did will finally apply, after about 6~8 mins.</p>