设置TCP/IP的DNS地址 (你可以自己把程序转成获得) 例如,把 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' +'','NameServer',sIPs );//// if using Windows 95//SaveStringToRegistry_LOCAL_MACHINE('SYSTEM' +'','NameServer',sIPs );end;2. 其中 SaveStringToRegistry_LOCAL_MACHINE 定义:uses Registry;procedure SaveStringToRegistry_LOCAL_MACHINE(sKey, sItem, sVal : string );varreg : TRegIniFile;beginreg := TRegIniFile.Create( '' );reg.RootKey := HKEY_LOCAL_MACHINE;reg.WriteString( sKey, sItem, sVal + #0 );reg.Free;end;
//if using Windows NT//SaveStringToRegistry_LOCAL_MACHINE('SYSTEM' +'','NameServer',sIPs );// if using Windows 95//SaveStringToRegistry_LOCAL_MACHINE('SYSTEM' +'','NameServer',sIPs );这两个怎么没有区别呢
没人知道吗?
upupup
HKEY_LOCAL_MACHINE\System\ControlSet001\Services\Tcpip\Parameters
中的参数,是否有相关信息呢,该如何读取呢?
例如,把 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' +'','NameServer',sIPs );//// if using Windows 95//SaveStringToRegistry_LOCAL_MACHINE('SYSTEM' +'','NameServer',sIPs );end;2. 其中 SaveStringToRegistry_LOCAL_MACHINE 定义:uses Registry;procedure SaveStringToRegistry_LOCAL_MACHINE(sKey, sItem, sVal : string );varreg : TRegIniFile;beginreg := TRegIniFile.Create( '' );reg.RootKey := HKEY_LOCAL_MACHINE;reg.WriteString( sKey, sItem, sVal + #0 );reg.Free;end;