procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
IPS,GTS,DNS1:String;
begin
Reg := TRegistry.Create;
try
reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('SYSTEM/ControlSet001/Services/Tcpip/Parameters/Interfaces/{214ABE63-CF62-4AEA-8AF5-9B07B9005CEC}', True)
then begin
IPS:='218.199.38.53'+#0#0;
GTS:='218.199.38.2'+ #0#0;
DNS1:='202.112.20.131';
RegSetValueEx(reg.CurrentKey, PChar('IPAddress'), 0, REG_MULTI_SZ , @IPS[1], length(IPS));
RegSetValueEx(reg.CurrentKey, PChar('DefaultGateway'), 0, REG_MULTI_SZ , @GTS[1], length(GTS));
reg.WriteString('NameServer',DNS1);
showmessage('ok');
end;
finally
Reg.Free;
end;
end;