1,183
社区成员
发帖
与我相关
我的任务
分享
RegRootKey:=TRegistry.Create;
RegRootKey.RootKey := HKEY_LOCAL_MACHINE;
try
PCName:=Trim(Edit1.Text);
if regRootKey.OpenKey('\SYSTEM\ControlSet001\Control\ComputerName\ComputerName\', True) then
begin
regRootKey.WriteString('ComputerName',PCName);
if regRootKey.OpenKey('\SYSTEM\ControlSet001\Services\Tcpip\Parameters', True) then
begin
regRootKey.WriteString('NV Hostname',PCName);
if regRootKey.OpenKey('\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName', True) then
begin
regRootKey.WriteString('ComputerName',PCName);
if regRootKey.OpenKey('\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters', True) then
begin
regRootKey.WriteString('NV Hostname',PCName);
end;
end;
end;
end;
finally
end;