This is the example to write
hexadecimal value to the registry
procedure TForm1.Button1Click(Sender: TObject);
var
str: string;
dw: dword;
reg: TRegistry;
begin
str := '02000000';
try
dw := StrToInt('$' + str); // $ because it's a hex value
reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
if reg.OpenKey('Software\MyCompany\MyKey', true) then
reg.WriteInteger('MyDword', dw);
finally
reg.free;
end;
except
on EConvertError do
; // not a valid integer in the string
end;
end;
Source
comments