This site is temporarily down. Please come back. Changing the TCP/IP DNS address
DelphiFAQ Home Search:

Changing the TCP/IP DNS address

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

A Domain Name Server convert mnemonic internet addresses to their natural numeric IP addresses e.g. preview.org = 209.204.209.81

If you have a need to dynamically change your DNS servers from your program, you can do so by calling the the following

uses
  Registry;

procedure SaveStringToRegistry_LOCAL_MACHINE (sKey, sItem, sVal: string);
var
  Reg : TRegIniFile;
begin 
  Reg := TRegIniFile.create (''); 
  Reg.RootKey := HKEY_LOCAL_MACHINE; 
  Reg.WriteString (sKey, sItem, sVal + #0); 
  Reg.Free
end; 


procedure SetTCPIPDNSAddresses (sIPs: string); 
begin 
  if RunningWinNT then 
  begin 
    // 
    // if using Windows NT 
    // 
    SaveStringToRegistry_LOCAL_MACHINE (
      'SYSTEM\CurrentControlSet\Services\Tcpip\Parameters',
      'NameServer', sIPs)
  end 
  else 
  begin 
    // 
    // if using Windows 95 
    // 
    SaveStringToRegistry_LOCAL_MACHINE (
      'SYSTEM\CurrentControlSet\Services\VxD\MSTCP',
      'NameServer', sIPs)
  end 
end;

Content-type: text/html

Comments:

2006-03-23, 11:14:25
anonymous from Denmark  
But.. can i get a DNS address if i dont have a domain?


-Teis
2015-02-01, 08:21:26
anonymous from Dubai, United Arab Emirates  
Was totally stuck until I read this, now back up and runinng.
2015-02-03, 19:21:07
anonymous from Venezuela  
You write so hotsenly about this. Thanks for sharing! http://ibwtgrxdr.com [url= http://koeojye.com]..ojye[/url] [link= http://vslqpftl.com..ftl[/link]
2015-02-03, 19:21:22
anonymous from Venezuela  
You write so hotsenly about this. Thanks for sharing! http://ibwtgrxdr.com [url= http://koeojye.com]..ojye[/url] [link= http://vslqpftl.com..ftl[/link]
2015-02-05, 22:39:33
anonymous from Japan  
extreme http://viagraqw.com major differences construction country http://carinsurance..quotes.com musty sexual benefits http://buyviagra.click pills work spending http://cialiswx.net keep tablet comes http://levitraon.net change then television http://cialisonline.club use natural minimum http://buycilaisnow.com adverse side

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: