Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Quick and Easy registry explorer. Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Registry explorer 17-Mar-04
Category
N/A
Language
Delphi All Versions
Views
441
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			1   
2   //this code will allow you to create a quick and easy registery explorer.


3   
4   procedure TForm1.FormCreate(Sender: TObject);
5   begin
6   //adds the 4 main Registry keys for user to select to explore the registry.
7   
8   TreeView1.Items.Add(nil,'HKEY_CLASSES_ROOT\');
9   TreeView1.Items.Add(nil,'HKEY_CURRENT_USER\');
10  TreeView1.Items.Add(nil,'HKEY_LOCAL_MACHINE\');
11  TreeView1.Items.Add(nil,'HKEY_CURRENT_CONFIG\');
12  end;
13  
14  procedure TForm1.TreeView1Click(Sender: TObject);
15  begin
16   //used to get subkeys of a seleced node to display.
17     GetSubKeys(TreeView1.Selected);
18  end;
19  
20  procedure TForm1.GetSubKeys( tnSub: TTreeNode);
21  var
22   slkeys: TStringList; //string list to hold subkeys of main key
23   i: Integer; //used to incroment trough string list.
24   tnKey: TTreeNode; //tree node to find parent node
25  begin
26    with TRegistry.Create do
27     try
28       tnKey:=tnSub;
29  
30    while tnKey.Level >0 do // loop to find parent
31      tnkey:=tnKey.Parent;  //parent node found
32  
33      //check to find what Key the parent is from and assign it to the
34      //registry component to open.
35  
36      if tnkey.Text ='HKEY_CLASSES_ROOT\' then
37        RootKey := HKEY_CLASSES_ROOT
38      else if tnkey.Text ='HKEY_CURRENT_USER\' then
39        RootKey := HKEY_CURRENT_USER
40      else if tnkey.Text ='HKEY_LOCAL_MACHINE\' then
41        RootKey := HKEY_LOCAL_MACHINE
42      else if tnkey.Text ='HKEY_CURRENT_CONFIG\' then
43        RootKey := HKEY_CURRENT_CONFIG;
44  
45      if tnSub.Level=0 then // if parent node is selected then get subkeys
46        OpenKey( '',false )
47      else
48        OpenKey( tnSub.Text,false );//if subnode selected then get subkeys of subnode
49  
50        slKeys := TStringList.Create;
51        try
52          GetKeynames(slkeys); //gets the subkey names of the open parent key.
53          CloseKey;
54          TreeView1.Items.EndUpdate;//used to cut down time in display alot of node
55  
56          for i := 0 to slKeys.Count - 1 do
57          begin
58          if tnSub.Level=0 then begin
59           //add subkeys of main keys to  tree node.
60            TreeView1.items.AddChild(tnSub,slKeys[i]+'\') ;
61          end  
62         else
63           //add subkeys of registry to tree node
64            TreeView1.items.AddChild(tnSub,tnSub.Text+ slKeys[i]+'\')  
65        end;
66  
67          TreeView1.Items.BeginUpdate;//turn on to display nodes
68        finally
69          slkeys.Free
70        end;
71      finally
72        Free;
73      end;
74  end;



			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC