Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
|
Retrieve a list of all installed applications
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Under Windows 95, 98, ME, NT and Windows 2000 it is common habit that applications write their installation information into the registry under
HKEY_LOCAL_MACHINE\Software\Mirosoft\Windows\CurrentVersion\UnInstall
Each application has a subkey there and at least defines a display name and an uninstall string.
On my system here I noticed that Allaire Homesite left its installation stamp in HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. So to be save, one might want to scan below HKEY_CURRENT_USER as well. The following sample application retrieves the installed applications and version number - feel free to use it or download it.
 | |  | | {sc-----------------------------------------------------------------------
Copyright (c) 1997-2001
software preview
Modified by Peter Tiemann on 2/18/2001
Percentage of Comments/ Cyclometric Complexity Numbers by function:
-------------------------------------------------------------------
TForm1.FormCreate 9% 5
Download
-----------------------------------------------------------------------sc}
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
uses
Registry;
{sc-----------------------------------------------------------------------
Name: TForm1.FormCreate
Parameters:
Sender
Returns:
-
Cyclometric Complexity: 5 , 3 comments in 32 lines = 9%
Purpose:
Retrieve installed apps and collect some info about them
Date Coder CRC Comment
02/18/01 Tiemann 58 Initial version!
-----------------------------------------------------------------------sc}
procedure TForm1.FormCreate(Sender: TObject);
var
aList: TStrings;
i: Integer;
sVersion: string;
const
sUninstall = 'Software\Microsoft\Windows\CurrentVersion\UnInstall';
begin
aList := TStringList.Create;
with TRegistry.Create do
begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(sUninstall, False) then
begin
GetKeyNames(aList);
CloseKey;
for i := 0 to aList.Count - 1 do
begin
if OpenKey(sUninstall +
'\' +
aList[i], False) then
begin
if ValueExists('DisplayVersion') then
sVersion := 'Version ' + ReadString('DisplayVersion')
else
sVersion := '';
ListBox1.Items.Add(aList[i] + #9 + sVersion);
CloseKey
end;
end;
end;
Free
end;
aList.Free
end;
end. | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|
anonymous from Iran
|
|
|
|
hi I can get installed programs list but i want make some thing like windows all program with installed programs icon and when i click on one of them that program start running
how i must do that?
|
|