OK: pp/source/fcl/inc/registry.pp If this unit is implemented, the other unit…
Luis R. Hilario B. wrote 48 lines
In principle pp/lazarus/lcl/registry.pp
should be abandoned if the fcl/inc/registry.pp one is completed for linux, yes.
Michael.

Mailing lists / lazarus / 2000-11
11 messages · 6 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
OK: pp/source/fcl/inc/registry.pp If this unit is implemented, the other unit…
In principle pp/lazarus/lcl/registry.pp
should be abandoned if the fcl/inc/registry.pp one is completed for linux, yes.
Michael.
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
It worked.
Really which was the "trick"? ((LongInt) = 0) ?
I do not know OOP nor Delphi. Days ago I obtained Delphi 5 (Demo) from the site of Borland, to learn.
Thanks Jeff.
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
In other words:
If the result of the function is equal to 0 then true otherwise false, but that easy! :-D
is function = 0?
Thanks to teach and excuses to me all (by the idiot questions).
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
Luis R. Hilario B. wrote[..TestReg.pp..] The previous example has a very great size and uses GTK. How can be reduced the size and not be used GTK?
The problem is the usage of some lazarus units. If you change the uses line in registry.pp to
uses
Classes, Sysutils;and add the following code to it's interface the size should be greatly reduced:
=============
const
//==============================================
// Registry constants
//==============================================
{ Provided for compatibility with Windows registry ONLY }
HKEY_CLASSES_ROOT = $80000000;
HKEY_CURRENT_USER = $80000001;
HKEY_LOCAL_MACHINE = $80000002;
HKEY_USERS = $80000003;
HKEY_PERFORMANCE_DATA = $80000004;
HKEY_CURRENT_CONFIG = $80000005;
HKEY_DYN_DATA = $80000006;
type
HKEY = Integer;
PHKEY = ^HKEY;
==============These definitions are in lcllinux now, which requires gtk (or any other interface?). Maybe we should change this some day...
bye,
Stefan
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?
The function result is a boolean, and the expression (RegDeleteKey(fRootKey, KeyP) = 0) evaluates to a boolean (think along the lines of IF X = Y THEN...). The outer parenthesis are not needed, but I use them for clarity when assigning to a boolean this way.
Jeff.
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
With the rest of the Lazarus components, we didn't use {$IFDEF WIN32} clauses. That was part of making the component set platform independent. If you need to write some platform specific code, then it should be implemented the same way as the other components.
I haven't done anything with all this for quite a while now, so I don't remember how we were doing it. But I believe there is a how-to on the Lazarus site that explains how to implement platform specific code in the components.
I also agree that it is better to use the TRegistry component in the FCL and to implement a Linux version of it.
Curtis
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
Yes you are right.
I hope that "some day" not be very distant. After all it is not difficult to do it.
The FCL contains a TRegistry class that works on Windows. It should be extended to work…
OK: pp/source/fcl/inc/registry.pp
If this unit is implemented, the other unit (pp/lazarus/lcl/registry.pp) has sense?
The changes and new things: registry.inc ============ function TRegistry.DeleteKey(const…
Does anyone else use this form below?
{$IFDEF WIN32}
Result := (RegDeleteKey(fRootKey, KeyP) = 0);
{$ELSE}
Result := False;
// Result := (XMLRegDeleteKey(fRootKey, KeyP) = 0); ???
{$ENDIF}I find that eliminating the intermediates is somehow "cleaner".
Sorry not to comment on the issue at hand, however...
Jeff.
The problem is the usage of some lazarus units. If you change the uses line in…
The FCL contains a TRegistry class that works on Windows. It should be extended to work on Linux, and should not depend on GTK at all...
Michael.