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
|
Const
Root = HKEY_LOCAL_MACHINE;
Key = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\';
begin
with ListView1 do
begin
List := TStringList.Create;
Reg := TRegistry.Create;
Reg.RootKey := Root;
Reg.OpenKey(Key,false);
Reg.GetKeyNames(List); //Liste les clés du registre
Reg.CloseKey;
for i := 0 to List.Count - 1 do
begin
s := List.Strings[i];
Reg.OpenKey(Key + s,false);
if Reg.ValueExists('DisplayName') then
begin
s := Reg.ReadString('DisplayName');
unistall := '';
if Reg.ValueExists('UninstallString') Then unistall := Reg.ReadString('UninstallString');
ListItem := listview1.Items.Add;
ListItem.Caption := s; //Affiche le nom du programme
ListItem.SubItems.Add(unistall); // pour desinstaller
end;
Reg.CloseKey;
end;
finally
Reg.Free;
List.Free;
end;
end; |
Partager