Ignore:
Timestamp:
Jul 26, 2012, 1:15:17 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Reverted deletion of URegistry unit. New package GeneralRegistry is not finished and 100% usable yet.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/ULastOpenedList.pas

    r390 r393  
    66
    77uses
    8   Classes, SysUtils, UGeneralRegistry, Menus;
     8  Classes, SysUtils, Registry, URegistry, Menus;
    99
    1010type
     
    2323    destructor Destroy; override;
    2424    procedure LoadToMenuItem(MenuItem: TMenuItem; ClickAction: TNotifyEvent);
    25     procedure LoadFromRegistry(Root: Integer; const Key: string);
    26     procedure SaveToRegistry(Root: Integer; const Key: string);
     25    procedure LoadFromRegistry(Root: HKEY; Key: string);
     26    procedure SaveToRegistry(Root: HKEY; Key: string);
    2727    procedure AddItem(FileName: string);
    2828  published
     
    8787end;
    8888
    89 procedure TLastOpenedList.LoadFromRegistry(Root: Integer; const Key: string);
     89procedure TLastOpenedList.LoadFromRegistry(Root: HKEY; Key: string);
    9090var
    9191  I: Integer;
    92   Registry: TGeneralRegistry;
     92  Registry: TRegistryEx;
    9393  FileName: string;
    9494begin
    95   Registry := TGeneralRegistry.Create(nil);
     95  Registry := TRegistryEx.Create;
    9696  with Registry do
    9797  try
    98     CurrentRoot := Root;
     98    RootKey := Root;
    9999    OpenKey(Key, True);
    100100    Items.Clear;
    101101    I := 0;
    102102    while ValueExists('File' + IntToStr(I)) and (I < MaxCount) do begin
    103       if ValueExists('File' + IntToStr(I)) then
    104         FileName := UTF8Encode(ReadString('File' + IntToStr(I)))
    105         else FileName := '';
     103      FileName := UTF8Encode(ReadStringWithDefault('File' + IntToStr(I), ''));
    106104      if Trim(FileName) <> '' then Items.Add(FileName);
    107105      Inc(I);
     
    114112end;
    115113
    116 procedure TLastOpenedList.SaveToRegistry(Root: Integer; const Key: string);
     114procedure TLastOpenedList.SaveToRegistry(Root: HKEY; Key: string);
    117115var
    118116  I: Integer;
    119   Registry: TGeneralRegistry;
     117  Registry: TRegistryEx;
    120118begin
    121   Registry := TGeneralRegistry.Create(nil);
     119  Registry := TRegistryEx.Create;
    122120  with Registry do
    123121  try
    124     CurrentRoot := Root;
     122    RootKey := Root;
    125123    OpenKey(Key, True);
    126124    for I := 0 to Items.Count - 1 do
Note: See TracChangeset for help on using the changeset viewer.