Ver Mensaje Individual
  #8  
Antiguo 08-07-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola de nuevo Antonio.

Me acabo de dar cuenta que pegué una de mis pruebas pero no la final y aunque igual funciona, te hacerco mis disculpas.

Esta la versión que corresponde:
Código Delphi [-]
function isAppInstalled(AppName: string): Boolean;
const
  CLAVE = '\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\';
var
  Reg: TRegistry;
  L1,L2 : TStringList;
  c: integer;
begin
  Reg:= TRegistry.Create;
  L1:= TStringList.Create;
  L2:= TStringList.Create;
  try
    Reg.RootKey:= HKEY_LOCAL_MACHINE;
    Reg.OpenKey(CLAVE, False);
    Reg.GetKeyNames(L1);
    Result:= False;
    c:= 0;
    while not Result and (c < L1.Count) do
    begin
      Reg.OpenKeyReadOnly(CLAVE+L1[c]);
      Reg.GetValueNames(L2);
      if(L2.IndexOf('DisplayName')<> -1)and
        (L2.IndexOf('UninstallString')<> -1)and
        (Reg.ReadString('DisplayName')=AppName) then
          Result:= True;
      Inc(c);
    end;
  finally
    L1.Free;
    L2.Free;
    Reg.Free;
  end;
end;
Para obtener la ruta estoy un poco complicado.
En teoría deberían estar en: \SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\, pero no estan todas.
Y además hay casos como por ejemplo: Malwarebytes' Anti-Malware, cuyo nombre aparece como: mbam.exe. Allí si encontramos Path = C:\Program Files\Malwarebytes' Anti-Malware.
Entonces deberíamos enviar como argumento mbam y no Malwarebytes' Anti-Malware para que lo encuentre...
Voy a tener que investigar un poco mas.

Un saludo.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita