Examples Delphi

Title: Retrieving the list of Installed Applications
Question: How can I get the list of installed applications?
Answer:
{
Author: Cosmin Prlitu
E-mail: cosmin.pirlitu@mail.com

The following code uses one ListBox (lbApps) and one button (btnGetApps) placed on the form (frmMain).
When the user clicks on the "Get App List" button the program extracts the list of all the installed apps from the Registry and adds *only* the valid ones to the ListBox.
I appologise for eventual spelling errors...
}
uses Registry;
{...code...}
const BaseKey = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall';
{...code...}
procedure TfrmMain.btnGetAppsClick(Sender: TObject);
var Reg: TRegistry;
Entries, i: integer;
vList: TStringList;
begin
lbApps.Clear;
Reg:=TRegistry.Create;
vList:=TStringList.Create;
with Reg do
begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey(BaseKey, False);
GetKeyNames(vList);
Entries:=vList.Count;
for i:=0 to Entries-1 do
begin
CloseKey;
OpenKey(BaseKey+'\'+vList.Strings[i],false);
if ValueExists('DisplayName') then
lbApps.Items.Add(ReadString('DisplayName'))
end;
end;
{ cleanup after job is done }
Reg.Free;
vList.Free;
end;