[Setup]
AppName=FactuGES
AppVerName=FactuGES 2.3.2
AppPublisher=Rodax Software S.L.
AppPublisherURL=http://www.rodax-software.com
AppSupportURL=http://www.rodax-software.com
AppUpdatesURL=http://www.rodax-software.com
OutputBaseFilename=instalar
Compression=lzma
SolidCompression=yes
CreateAppDir=no
Uninstallable=no
DisableStartupPrompt=yes
DisableFinishedPage=yes

[Languages]
Name: "sp"; MessagesFile: "compiler:languages\Spanish.isl"

[Files]
Source: "files\*"; DestDir: {code:GetDir}; CopyMode: alwaysoverwrite; Flags:  uninsneveruninstall overwritereadonly
;Source: "files\Informes\*"; DestDir: "{code:GetDir}\Informes\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "files\Financiacion\*"; DestDir: "{code:GetDir}\Financiacion\"; Flags: ignoreversion recursesubdirs createallsubdirs

[Registry]
;Root: HKLM; Subkey: "Software\FactuGES\Update"; ValueType: string; ValueName: "edLocation_Text"; ValueData: "http://www.rodax-software.com/luisleon/update"; Flags: createvalueifdoesntexist

[Code]
const
  WM_CLOSE = $0010;
  
var
  TipoActualizacion : String;
  Ruta : String;
  VerAnterior : String;
  VerNueva : String;

function GetDir(Param: String): String;
begin
  Result := Ruta;
end;

function InitializeSetup(): Boolean;
var
  p:  HWND;
begin
  // Comprobar que FactuGES no está en ejecución
  p := FindWindowByWindowName('FactuGES');
//  p := FindWindowByClassName('FactuGES');
  while p > 0 do
  begin
//    MsgBox('Debe salir de FactuGES para poder instalar esta actualización',mbInformation, MB_OK);
//    Result := False
    SendMessage(p,WM_CLOSE,0,0);
    p := FindWindowByWindowName('FactuGES');
  end;
    Result := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\FactuGES', 'Ruta', Ruta);
//  end
//  else begin
    // Comprobar que la ruta del programa está en el registro
//    Result := RegQueryStringValue(HKEY_LOCAL_MACHINE, 'Software\FactuGES', 'Ruta', Ruta);
//  end;
end;




