CodePudding user response:
Study the CMD netsh commandCodePudding user response:
if regRootKey. OpenKey (' \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters \ Interfaces \ '+ CardList. Strings [cbb1. ItemIndex], True)
Then the begin
If CheckBox1. Checked//judge whether to enable the DHCP
Then the begin
RegRootKey. WriteInteger (' EnableDHCP ', 1);
RegRootKey. WriteString (' NameServer ', ');
WriteIp (regRootKey CurrentKey, 'IPAddress', '0.0.0.0');
WriteIp (regRootKey CurrentKey, 'SubNetMask', '0.0.0.0');
WriteIp (regRootKey CurrentKey, 'DefaultGateway', ');
End
The else begin
RegRootKey. WriteInteger (' EnableDHCP, 0).
RegRootKey. WriteString (NameServer, Trim (Combobox1. Text));
WriteIp (regRootKey CurrentKey, 'IPAddress, Trim (Edit2. Text));
WriteIp (regRootKey CurrentKey, 'DefaultGateway, Trim (Edit4. Text));
WriteIp (regRootKey CurrentKey, 'SubNetMask, Trim (Edit3. Text));
WriteIp (regRootKey CurrentKey, 'DefaultGateway, Trim (Edit4. Text));
end;
end;
Can be set by the registry, IP, the code is shown,