Ich denke mal, so ist es besser. Ob mein Stil euch aber gefällt, ist eine andere Sache
Delphi-Quellcode:
procedure GetUninstallList(AList: TStrings);
const
UNINSTALL_PATH = 'Software\Microsoft\Windows\CurrentVersion\Uninstall\';
DISPLAY_NAME = 'DisplayName';
var
LIndex: Integer;
begin
AList.Clear;
With TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
If KeyExists(UNINSTALL_PATH) and OpenKeyReadOnly(UNINSTALL_PATH) then
begin
GetKeyNames(AList);
CloseKey;
end;
LIndex := 0;
While LIndex < AList.Count do
begin
If not (OpenKeyReadOnly(UNINSTALL_PATH + AList[LIndex]) and
ValueExists(DISPLAY_NAME)) then AList.Delete(LIndex)
else begin
AList[LIndex] := ReadString(DISPLAY_NAME);
Inc(LIndex);
end;
CloseKey;
end;
finally
Free;
end;
end;