2000
winexec(pchar('netsh interface ip set address "本地连接" static 172.16.100.100 255.255.0.0 172.16.200.2 1'),sw_hide);
98
修改注册表
如://注意得重启计算机才能真正生效
var
MyReg: TRegistry;
i : integer;
begin
MyReg := TRegistry.Create;
try
MyReg.RootKey := HKEY_LOCAL_MACHINE;
if MyReg.OpenKey('/Enum/Network/MSTCP',false) then
begin
for i := 1 to 9 do
begin
if MyReg.OpenKey('/Enum/Network/MSTCP/000' + inttostr(i),false) then
begin
MyReg.WriteString('IPAddress','192.9.201.9');
MyReg.WriteString('IPMask','255.255.255.0');
MyReg.WriteString('DefaultGateway','192.9.201.1');
MyReg.CloseKey;
Break;
end;
end;
end;
finally
MyReg.Free;
end;
end;