Delphi中如何读取注册表的(二进制)键值并复制到别的键值里?
[b][color=Red]如:HKEY_LOCAL_MACHINE\SOFTWARE项里的A键,键值为REG_BINARY(二进制),把A的键值复制给B的键值.
经在百度和谷歌搜索答案都没列出列子,望前辈们指教![/color][/b] delphi的HELP中本身就有例子的,改一下就可以了
Delphi(Pascal) code
uses Registry;
procedure TForm1.Button1Click(Sender: TObject);
var
Reg: TRegistry;
buff:array [0..100] of byte;
len:integer;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if Reg.OpenKey('Software', True) then
begin
len:=Reg.ReadBinaryData('A',buff,100);
Reg.WriteBinaryData('B',buff,len);
Reg.CloseKey;
end;
finally
Reg.Free;
end;
end; 好东西!!!!!!
页:
[1]