[lazarus] The registry is alive

Luis R. Hilario B. luis at luis-digital.8m.com
Fri Nov 10 11:26:47 EST 2000


The changes and new things:

registry.inc
============

function TRegistry.DeleteKey(const Key: String): Boolean;
Var
  Val : LongInt;
  KeyP: PChar;

begin
  KeyP := @Key[1];

{$IFDEF WIN32}
  Val  := RegDeleteKey(fRootKey, KeyP);
{$ELSE}
  Val := 1;
  //  Val := XMLRegDeleteKey(fRootKey, KeyP); ???
{$ENDIF}
  If Val = 0 Then Result := True else Result := False;

end;

procedure TRegistry.SetRootKey(Value: HKEY);
begin
  fRootKey := Value;
end;

registry.pp
===========
uses
  {$IFDEF WIN32}
  Windows,
  {$ENDIF}
  Classes, Controls, SysUtils, vclGlobals, lMessages, LCLLinux;

TestReg.pp
==========
program TestReg;

Uses Registry, LCLLinux;

{$mode objfpc}

Var
  Reg: TRegistry;
  SubKey: String;

Begin
SubKey := 'Software\luis';
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
If Reg.DeleteKey(SubKey) Then Writeln('OK')
 else
  Writeln('Error: ', SubKey, ' - not empty or it does not exist.');
Reg.free;
End.

========

The previous example has a very great size and uses GTK.
How can be reduced the size and not be used GTK?

-- 
 |--------------------------|
| Luis R. Hilario            |
| http://luisdigital.2y.net  |
 |--------------------------|






More information about the Lazarus mailing list