Einzelnen Beitrag anzeigen

Benutzerbild von Deep-Sea
Deep-Sea

Registriert seit: 17. Jan 2007
907 Beiträge
 
Delphi XE2 Professional
 
#8

AW: Installed Software function

  Alt 24. Mai 2011, 09:34
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;
Chris
Die Erfahrung ist ein strenger Schulmeister: Sie prüft uns, bevor sie uns lehrt.
  Mit Zitat antworten Zitat