VCL Delphi

Title: Create a Treeview with Keys from the Registry
Question: Anyone have any sample code on how to load a TreeView with registry keys, i want to load the KEY_CURRENT_USER\\Software key, and i want all the subkeys to load in the treeview too.
Answer:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, Registry;
type
TForm1 = class(TForm)
TreeView1 : TTreeView;
Button1 : TButton;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
Procedure FillRegBranch ( rootkey:hkey; parentkey:String; ParentNode:TTreeNode);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
VAR
Node : TTreeNode;
begin
TreeView1.Items.Clear;
TreeView1.Items.BeginUpdate;
Node := TreeView1.Items.AddChild (NIL,'Borland');
FillRegBranch ( HKEY_Local_Machine,'Software\Borland',Node );
TreeView1.Items.EndUpdate;
end;
procedure tForm1.FillRegBranch ( rootkey:hkey; parentkey:String; ParentNode:TTreeNode);
VAR
Cnt : Integer;
StList : TStrings;
Node : tTreeNode;
Registry : TRegistry;
Begin
Registry := TRegistry.Create;
Try
Registry.RootKey := rootkey;
IF Registry.OpenKey ( parentkey,false) Then
Begin
StList := tStringlist.Create;
Try
Registry.GetKeyNames ( StList );
For Cnt := 0 TO StList.count-1 Do
Begin
Node := TreeView1.Items.addChild ( ParentNode,StList.Strings[cnt]);
IF Registry.HasSubKeys
then FillRegBranch ( rootkey,parentkey+'\'+StList.Strings[cnt],node);
End;
Finally
StList.Free;
End;
End;
Finally
Registry.Free;
End;
End;
end.