Your code isn't a method of the form, and therefore has no access to Edit1
.
Either make it a form method:
type
TForm1=class(TForm)
...
private
procedure SetTCPIPDNSAddresses(sIPs : String);
...
end;
implementation
procedure TForm1.SetTCPIPDNSAddresses(sIPs : String);
begin
...
end;
Or change it to accept the contents of Edit1.Text
as another parameter:
procedure SetTCPIPDNSAddresses(sIPs : String; RegName: String);
begin
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSetServicesTcpipParametersInterfaces' +
RegName, 'NameServer', sIPs);
end;
And call it like:
SetTCPIPDNSAddresses(sTheIPs, Edit1.Text);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…