myamanda
例如,把 DNS Server的地址添加为192.0.0.1和192.1.1.0,可调用:
SetTCPIPDNSAddresses(\'192.0.0.1 192.1.1.0\') ;// 各地址之间用一个空格隔开

1. SetTCPIPDNSAddresses 定义如下:
procedure SetTCPIPDNSAddresses( sIPs : string );
begin
//
// if using Windows NT
//
SaveStringToRegistry_LOCAL_MACHINE(
\'SYSTEM\CurrentControlSet\' +
\'\Services\Tcpip\Parameters\',
\'NameServer\',
sIPs );
//
// if using Windows 95
//
SaveStringToRegistry_LOCAL_MACHINE(
\'SYSTEM\CurrentControlSet\' +
\'\Services\VxD\MSTCP\',
\'NameServer\',
sIPs );
end;

2. 其中 SaveStringToRegistry_LOCAL_MACHINE 定义:
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;

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-01-22
  • 2021-09-19
  • 2021-05-18
  • 2021-11-24
  • 2021-12-14
猜你喜欢
  • 2021-10-15
  • 2021-07-12
  • 2022-01-08
  • 2021-10-16
  • 2021-12-15
  • 2021-12-20
相关资源
相似解决方案