[fpc-pascal] Accessing the registry

Matt Emson memsom at interalpha.co.uk
Mon May 3 02:06:14 CEST 2004


> I would like to access the registry, but cannot figure out how to get
> anywhere with it.

If it uses a class similar to Delphi's :

var
  Reg: TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunOnce',
True)
    then Reg.WriteString('MyApp','"' + ParamStr(0) + '"');
  finally
    Reg.CloseKey;
    Reg.Free;
  end;
end;

This is pasted from the Delphi 5 helpfile.






More information about the fpc-pascal mailing list