Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to get the installed software Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Get the installed software Display Name and UninstallString. 29-Jul-04
Category
System
Language
CBuilder All Versions
Views
500
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			1   
2   /*
3    The installed software information is stored in the Registry.
4   
5     Installed on All Users
6      Rootkey : HKEY_LOCAL_MACHINE
7      Path : SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
8   
9     Installed on Current User
10     Rootkey : HKEY_CURRENT_USER
11     Path : SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
12  
13   DisplayName is the title of the program.
14   UnistallString is the path used for uninstallation of the software.
15   If DisplayName and UnistallString exists it is a installet program.
16  */
17  
18  //This example shows how to get the installed software for all users.
19  //---------------------------------------------------------------------------
20  
21  #include <vcl.h>
22  #include <Registry.hpp>
23  #pragma hdrstop
24  
25  #include "Unit1.h"
26  //---------------------------------------------------------------------------
27  #pragma package(smart_init)
28  #pragma resource "*.dfm"
29  TForm1 *Form1;
30  //---------------------------------------------------------------------------
31  __fastcall TForm1::TForm1(TComponent* Owner)
32          : TForm(Owner)
33  {
34  }
35  //---------------------------------------------------------------------------
36  
37  void __fastcall TForm1::Button1Click(TObject *Sender)
38  {
39     TStringList *Keys = new TStringList();
40     TRegistry *Reg = new TRegistry();
41  
42    // Change the rootkey to HKEY_CURRENT_USER to get the installed software for the 
43  current user.
44     Reg->RootKey = HKEY_LOCAL_MACHINE ;
45     Reg->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", false);
46     Reg->GetKeyNames(Keys);
47     Reg->CloseKey();
48    for(int i=0;i<Keys->Count;i++){
49   if (Reg->OpenKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\"+
50    Keys->Strings[i], false)) {
51    if(Reg->ValueExists("DisplayName") == Reg->ValueExists("UninstallString")){
52     ListBox1->Items->Add(Reg->ReadString("DisplayName")+" | 
53  "Reg->ReadString("UninstallString"));
54     Reg->CloseKey();
55     }
56    }
57    }
58    Reg->Free();
59    Keys->Free();
60  
61  }
62  //---------------------------------------------------------------------------
63   


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC