What i want to do is to write a binary value (record called Settings) into the registry as a binary instead of to a file. It is 176 bytes in length and for the life of me i can't get the WriteBinaryData to work. I know this will be something simple. Could someone please post me a small sample of code that i need and what parms to put where to get this procedure working. and how do you tell it what binary data to write to it.
Thanks.
Dane.
--- Cut From Delphi 2 Help File.
Applies to
TRegistry object, TRegIniFile object
Declaration
procedure WriteBinaryData(const Name: string; var Buffer; BufSize: Integer);
This really simple code does, hopefully, what you want.
procedure TMainForm.Button15Click(Se
type
TTestRec = record
Name : string[10];
Number: Comp;
end;
var
Ini: TRegistry;
Rec: TTestRec;
begin
Ini := TRegistry.Create;
if Ini.OpenKey('\software\Dan
then begin
with Rec do begin
Name := 'Dane';
Number := 8630007314.0;
end;
Ini.WriteBinaryData('TestB
FillChar(Rec, SizeOf(TTestRec), 0); // Clear record contents
Ini.ReadBinaryData('TestBu
with Rec do begin
Caption := Format('%s - %.0f', [Name, Number]);
end;
end;
Ini.Free;
end;
Enjoy!
/// John