Link to home
Start Free TrialLog in
Avatar of CodedK
CodedKFlag for Greece

asked on

How can i enumerate all subfolders of a folder in registry in TreeView.

Hi.

The title is self-explanatory.

I need to list in a treeview the subfolders (not the subfolders of the subfolders  (Depth=1)) of a path in registry.

Example : ( List SubFolders of    HKEY_USERS\Default )
------------------------------------------
HKEY Users
|->Default
      |-> AppEvents
      |-> Console
      |-> Control Panel
      |-> EHelp
      |-> Environment

------------------------------------------

Thanks in advance :)
ASKER CERTIFIED SOLUTION
Avatar of atul_parmar
atul_parmar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CodedK

ASKER

Thanks :) ... both

Well if itsnt too much to ask do you know how can i filter those subfolders and list only those...
if they contain a subfolder named "2" ?
After retrieving the list to stringlist you can simply check / search into it.
e..g
s.IndexOf('2'); // will return the index if found -1 otherwise.

OR

var
  Reg : TRegistry;
begin
  Reg := TRegistry.Create;
  Reg.RootKey := HKEY_USERS;
  Reg.OpenKey('.DEFAULT', False);
  if Reg.KeyExists('2') then
     ShowMesasage('The key exists');
  Reg.Free;
end;
Avatar of CodedK

ASKER

Thanks :)

I'll split the points if you dont mind...
That's fine.
Avatar of CodedK

ASKER

Ciuly how can i insert those values to an allready existing item in the treeview ?

TreeView1.Items.Addchild(existing node,text)