I need to convert a string to write it into a registry.reg_binary key.
I have the basic code for writing into the key as follows:
try
rootkey := HKEY_CURRENT_USER;
if OpenKey(Key, False) then
begin
reg.WriteBinaryData('SomeKey', SomeValue, Length(SomeVale));
CloseKey;
end;
finally
reg.Free;
end;
In the above, SomeValue needs to be the hex value of a TEdit text field;
My current tack is convert the TEdit.text using IntToHex on the Ord value of each character. This gives me a string that looks like what I want to write…
At this point I’m stumped…
Granted this assumes that your string only contains ansi data,
but if your trying to write a string to a registry value as a binary value then the following changes to your logic would work: