I have a routine that I have been using for years in Delphi to read the registry. However, it does not work with Lazarus. I looked at the Lazarus sources and examples and it seems that Lazarus uses it the same as Delphi. Can someone please tell me what I need to change? The routine is:

function ReadRegistry(RegKey, Key : string; var Value : String) : boolean;
var
   Reg : TRegistry;
begin
   Result := false;
   Reg := TRegistry.Create;
   try
       with Reg do
       begin
           RootKey := HKEY_CURRENT_USER;
           if OpenKey(RegKey, false) and ValueExists(Key)
           then begin
               Value := ReadString(Key);
               Result := true;
           end;
       end;
   finally
       Reg.Free;
   end;
end;

Regards
Andreas

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to