Ignore:
Timestamp:
Jul 18, 2012, 4:13:05 PM (12 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Common/ULastOpenedList.pas

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