1. Home
  2. Computing & Technology
  3. Delphi Programming

Retrieving a list of installed Applications on Windows

By Zarko Gajic, About.com

Here is a method for retrieving a list of installed applications on a particular machine running a Windows OS.

1. Start up Delphi.
2. Select File | New Application.
3. Add Registry to the uses of your new Unit.
4. Place a TListBox (ListBox1) component on your form.
5. Place a TButton (Button1) in your form.
6. Place the following code in the OnClick event of the Button1:

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure TForm1.Button1Click(Sender: TObject) ;
const
   REGKEYAPPS = '\SOFTWARE\Microsoft\Windows\
CurrentVersion\Uninstall';

var
   reg : TRegistry;
   List1 : TStringList;
   List2 : TStringList;
   j, n : integer;

begin
   reg := TRegistry.Create;
   List1 := TStringList.Create;
   List2 := TStringList.Create;

   {Load all the subkeys}
   with reg do
   begin
     RootKey := HKEY_LOCAL_MACHINE;
     OpenKey(REGKEYAPPS, false) ;
     GetKeyNames(List1) ;
   end;
  {Load all the Value Names}
   for j := 0 to List1.Count -1 do
   begin
     reg.OpenKey(REGKEYAPPS + '' + List1.Strings[j],false) ;
     reg.GetValueNames(List2) ;

     {We will show only if there is 'DisplayName'}
     n := List2.IndexOf('DisplayName') ;
     if (n <> -1) and
        (List2.IndexOf('UninstallString') <> -1) then
     begin
       ListBox1.Items.Add(
           (reg.ReadString(List2.Strings[n]))) ;
     end;
   end;
   List.Free;
   List2.Free;
   reg.CloseKey;
   reg.Destroy;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to get the number of words in Richedit
« How to get DBGrid Cell coordinates

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2002 Delphi Tips
  7. Retrieving a list of installed Applications on Windows

©2009 About.com, a part of The New York Times Company.

All rights reserved.