Delphi读写WINDOW注册表操作

评价:
5
(1用户)

//引用Registry;

//写入注册表函数

Function WriteReg(Rs:String):Boolean;
var
Reg: TRegistry;
begin
result := false;
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey(‘\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer’, True) then
begin
Reg.WriteString(‘defaultkey’,Rs);
result := true;
end;
finally
Reg.CloseKey;
Reg.Free;
end;
end;

//读取注册表键值函数

Function ReadReg:String;
var
Reg: TRegistry;
begin
result := ”;
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey(‘\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer’, false) then
result := Reg.ReadString(‘defaultkey’);
finally
Reg.CloseKey;
Reg.Free;
end;

end;

本文为原创文章,转载请注明出处!

注册并通过认证的用户才可以进行评价!

admin:支持一下,感谢分享!,+10,  

发表评论