Repository navigation
Expand file tree
/
Copy pathReg.pas
More file actions
89 lines (77 loc) · 2.19 KB
/
Copy pathReg.pas
File metadata and controls
89 lines (77 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
unit Reg;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,Buttons, Registry,Shellapi, ImgList, ComCtrls, DB,
DBClient, Grids, DBGrids;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
CheckBox1: TCheckBox;
DBGrid1: TDBGrid;
DataSource1: TDataSource;
ClientDataSet1: TClientDataSet;
ClientDataSet1Nome: TStringField;
ClientDataSet1Editor: TStringField;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
procedure ListaProgramasInstalados;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses StrUtils;
{$R *.dfm}
procedure TForm1.ListaProgramasInstalados;
Var
List:TStringList;
Registry : TRegistry;
I,J:Integer;
DisplayName,Publisher :String;
const cRegistroAplicacoes = 'Software\Microsoft\Windows\CurrentVersion\Uninstall';
begin
ClientDataSet1.EmptyDataSet;
Registry := TRegistry.Create(KEY_ALL_ACCESS OR $0100);
List := TStringList.Create;
try
with Registry do
begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(cRegistroAplicacoes,False) Then
Begin
GetKeyNames(List);
CloseKey;
End;
for i:=0 to List.Count-1 do
begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(cRegistroAplicacoes+'\'+List[i],False) then
begin
DisplayName := ReadString('DisplayName');
Publisher := ReadString('Publisher');
if (DisplayName <> '') and ((AnsiContainsText(UpperCase(Publisher),'TECNOSPEED')) or not (CheckBox1.Checked)) then
begin
ClientDataSet1.Append;
ClientDataSet1Nome.AsString := DisplayName;
ClientDataSet1Editor.AsString := Publisher;
ClientDataSet1.CheckBrowseMode;
end;
end;
CloseKey;
End;
end;
Finally
Registry.Free;
List.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListaProgramasInstalados;
Label1.Caption := IntToStr(ClientDataSet1.RecordCount)+' programas instalados em seu computador.';
end;
end.