So geht's:
Delphi-Quellcode:
var
reg: TRegistry;
BaseKey: string;
KeyNames: TStringList;
i: Integer;
begin
ListBox2.Clear;
reg := TRegistry.Create(KEY_READ);
try
reg.RootKey := HKEY_LOCAL_MACHINE;
BaseKey := '\Software\Microsoft\Windows\Currentversion\Uninstall';
if reg.OpenKey(BaseKey, False) then
begin
KeyNames := TStringList.Create;
try
reg.GetKeyNames(KeyNames);
for i := 0 to KeyNames.Count - 1 do
if reg.OpenKey(BaseKey + '\' + KeyNames[i], False) then
ListBox2.Items.Add(reg.ReadString('DisplayName'));
finally
KeyNames.Free;
end;
end
else
RaiselastOSError();
finally
reg.Free;
end;
BTW: OpenKeyReadOnly ist besser als OpenKey wenn Du nix schreiben mußt.