Solved

# Recursive search in registry

Posted on 2006-04-17
841 Views
Last Modified: 2008-01-09
Hi All,

Can someone please help me by providing sample code of a function that can make recursive search in Registry and place all the results in a StringList?

So in other words I need a function where I can send to it:
- HKEY (Ex. HKEY_LOCAL_MACHINE).
- Starting Key (Ex. \Software\)

Function Return
- StringList (Ex. MyStringList)

Then the function should get me all keys, SubKeys under HKEY_LOCAL_MACHINE\Software\ and return them to the calling function in a StringList.

Thanks in advance for your time...

0
Question by:GiantMatrix
2 Comments

LVL 26

Accepted Solution

0

LVL 10

Assisted Solution

Here is a coded sample:

uses
Registry;

{\$R *.dfm}

procedure GetRegistryList(const aRoot: HKEY; const aPath: string; const aStrings: TStrings);
var
lList: TStringList;
liEntry: Integer;
begin
with TRegistry.Create do
begin
RootKey := aRoot;
if OpenKey(aPath, False) then
begin
lList := TStringList.Create;
try
GetKeyNames(lList);
for liEntry := 0 to lList.Count-1 do
begin
aStrings.Add(aPath + '\' + lList[liEntry]);
GetRegistryList(aRoot, aPath + '\' + lList[liEntry], aStrings);
end;
finally
lList.Free;
end;
end;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
GetRegistryList(HKEY_LOCAL_MACHINE, 'Software\Borland', Memo1.Lines);
end;

Regards Jacco
0

## Join & Write a Comment Already a member? Login.

### Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This video discusses moving either the default database or any database to a new volume.

#### 734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

#### Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!