Как отобразить реестр в treeView в Delphi 7

Я хочу отобразить древовидный просмотр со всей информацией о реестре (т.е. все подключи). Я создал следующий Fn, чтобы сделать то же самое. Но я получаю информацию только об одном ключе, а не обо всех. Чего не хватает в моем коде?

 function TForm1.DisplayKeys(TreeNode : TTreeNode;KeyToSearch:String):String;
 var
  i: Integer;
  RootKey : Integer;
  NewTreeNode : TTreeNode;
  str : TStringList;

 // str2: TStringList;
 begin
   i:=0;

   if reg.OpenKey(KeyToSearch,False) then
   begin
   str:=nil;
   str:=TStringList.create;
   reg.GetKeyNames(str);
   //For all SubKeys
   for i:=0 to str.Count-1 do
   begin
      NewTreeNode:=TreeView1.Items.AddChild(TreeNode, Str.Strings[i]);
      if reg.HasSubKeys then
      begin
        DisplayKeys(NewTreeNode,Str.Strings[i]);
      end;
   end;
 end;

вызов функции

  procedure TForm1.FormCreate(Sender: TObject);
  begin
     reg:=nil;
    reg:=TRegistry.create;
    str2:=nil;
    str2:=TStringList.create;
   reg.RootKey:=HKEY_CURRENT_CONFIG;
   TreeView1.Items.BeginUpdate; //prevents screen repaint every time node is added
      DisplayKeys(nil,''); // call to fn here
   TreeView1.Items.EndUpdate; // Nodes now have valid indexes
 end;

Обратите внимание, что я не получаю никакой ошибки, просто информация неполная

6
задан menjaraz 3 January 2012 в 13:40
поделиться