If you connect to the Internet, a Domain Name Server (DNS) is generally required to convert English Internet addresses to their natural numeric IP addresses -- to convert www.chami.com to 1.2.3.4 for example.
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
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;
Listing #1 : Delphi code. Download registry (0.3 KB).
procedure
SetTCPIPDNSAddresses(
sIPs : string );
begin
//
// if using Windows NT
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesTcpipParameters',
'NameServer',
sIPs );
//
// if using Windows 95
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesVxDMSTCP',
'NameServer',
sIPs );
end;
SetTCPIPDNSAddresses(
sIPs : string );
begin
//
// if using Windows NT
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesTcpipParameters',
'NameServer',
sIPs );
//
// if using Windows 95
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesVxDMSTCP',
'NameServer',
sIPs );
end;
Listing #2 : Delphi code. Download setdns (0.33 KB).
SetTCPIPDNSAddresses(
'1.2.3.4 5.6.7.8' );
'1.2.3.4 5.6.7.8' );
Listing #3 : Delphi code. Download sample (0.17 KB).