Inno setup 使用inno设置安装firebird

Inno setup 使用inno设置安装firebird,inno-setup,firebird,Inno Setup,Firebird,我正在尝试使用Inno安装程序安装firebird和我的应用程序,但我有两个问题无法解决: 当计算机中已安装Firebird时,安装过程中会弹出一条消息:“现有Firebird xxx服务器正在运行。您必须关闭应用程序或停止服务,然后才能继续”。如果您已经安装了Firebird,我如何忽略此问题?我尝试了几个标志,还有更多的信息 如何让安装程序等待Firebird的安装完成,然后才运行应用程序?因为按照我的方式,它开始在后台安装Firebird,只是不希望完成,如果用户必须在安装结束时单击打开程

我正在尝试使用Inno安装程序安装firebird和我的应用程序,但我有两个问题无法解决:

  • 当计算机中已安装Firebird时,安装过程中会弹出一条消息:
    “现有Firebird xxx服务器正在运行。您必须关闭应用程序或停止服务,然后才能继续”
    。如果您已经安装了Firebird,我如何忽略此问题?我尝试了几个标志,还有更多的信息

  • 如何让安装程序等待Firebird的安装完成,然后才运行应用程序?因为按照我的方式,它开始在后台安装Firebird,只是不希望完成,如果用户必须在安装结束时单击打开程序,将给出一个错误,因为系统仍然无法打开数据库,因为Firebird仍在后台安装

  • 如何解决这两个问题?

    防止InitializeSetup中出现“现有firebird xxx服务器正在运行…”的消息 您可以检查Firebird服务器是否正在运行及其版本。 如果它正在运行且安装的版本不正确,您可以采取措施
    (停止安装,或在不安装Firebird或其他设备的情况下继续安装)

    如何做

    首先,您应该查找并下载以下文件:

    FirebirdInstallSupportFunctions.inc

    CheckIbaseFirebirdInstaled.inc

    并将其包含在代码部分:

    [Code]
    .....
    #include "FirebirdInstallSupportFunctions.inc"
    #include "CheckIbaseFirebirdInstaled.inc"
    .....
    
    在初始化设置中:

    function InitializeSetup():boolean;
    var
      MsgResult : Integer;
      MsgText: String;
    begin
       InstallSqlServer := true;
    
       //check for installed Firebird server version
       SQLServerRunning := IsSQlServerRunning;
    
       SQLServerInstalledVersion := GetSQLInstalledVersion;   
       case SQLServerInstalledVersion of
          0 : begin 
                if SQLServerRunning <> RUN_NONE then
                  begin
                    // there is an old version running ( InstalledVersion return 0 but server is running anyway)
                    MsgText := '....message.........';
                    MsgResult := MsgBox(MsgText,mbConfirmation,MB_OK);  //Show warning message
                    result := false;  //Abort Setup
                    exit;
                  end
                else
                  result := true;                 
          end;
          FB_INSTALLED_IS_NOT_VALID : begin
            MsgText := 'There is installed  ' + SummarizeInstalledProducts + #13 + 'This program required at least'+ '{#SQLServerVersion}'+ #13 + 'Do you want to continue?'  ;
            result := false;
            MsgResult := MsgBox(MsgText,mbConfirmation,MB_YESNO);
            if MsgResult = IDYES then 
              begin
                result := true;  //Continue setup
              end
            else 
              begin
                result := false;  //Abort Setup
              end;
          end
          FB_INSTALLED_IS_VALID : begin
            InstallSqlServer := false;  // The correct  Firebird server is installed 
            result := true;             //Continue Setup
          end
      end;
    end;
    
    使用过的功能

    [Code]
    const 
      FB_IS_NOT_INSTALED = 0;
      FB_INSTALLED_IS_NOT_VALID = -1;
      FB_INSTALLED_IS_VALID = 1;
      FB_UNKNOWN = 2;
    
      RUN_NONE = 0;
      RUN_FB1_IB = 1;
      RUN_FB = 2;
      RUN_FB_21_25 = 3;
      .....
    
    var 
      InstallSqlServer : boolean;
      SQLServerInstalledVersion : integer;
    
    //this function checks if Firebird is running
    function IsSQlServerRunning : integer;
    begin
      if FirebirdDefaultServerRunning then
        begin
          if RunningServerVerString = 'Firebird v1.0 / InterBase' then
            begin
              result := RUN_FB1_IB; 
            end;
          if RunningServerVerString = 'Firebird' then
            begin
              result := RUN_FB;
            end;
          if RunningServerVerString = 'Firebird v2.1 or v2.5' then
            begin
               result := RUN_FB_21_25;
            end;
         end
       else
         result := RUN_NONE;
    end;
    
    //Is this is a correct version
    function AnalysisAssessment: integer;
    var
      MsgText: String;
      MsgResult: Integer;
      VerString: String;
    begin
      if ProductsInstalledCount = 0 then
        begin
          FirebirdInstalledRootDir := ExpandConstant('{pf}') + '\' + ExpandConstant('{#FirebirdDir}');
          result := FB_IS_NOT_INSTALED;
          exit;
        end
       else
         if ProductsInstalledCount = 1 then
           begin
             if (ProductsInstalled < FB25) then // See CheckIbaseFirebirdInstaled.inc ->ProductsInstalled const
                result := FB_INSTALLED_IS_NOT_VALID
         else
           result := FB_INSTALLED_IS_VALID;
       end
     else
        result := FB_UNKNOWN;
    end;
    
    //this function gets installed version
    function GetSQLInstalledVersion : integer;
    begin
      InitExistingInstallRecords;
      AnalyzeEnvironment;
      result := AnalysisAssessment;
    end;
    
    
    function SummarizeInstalledProducts: String;
    var
      InstallSummaryArray: TArrayofString;
      product: Integer;
      i: Integer;
    begin
    
    //do nothing gracefully if we are called by accident.
      if ProductsInstalledCount = 0 then
    begin
      FirebirdInstalledRootDir := ExpandConstant('{pf}') + '\' + ExpandConstant('{#FirebirdDir}');
      exit;
    end;
      i := 0;
    
      SetArrayLength(InstallSummaryArray,ProductsInstalledCount);
    
      for product := 0 to MaxProdInstalled -1 do
    begin
       if (ProductsInstalledArray[product].InstallType <> NotInstalled) then
       //   result := result + intToStr(ProductsInstalledArray[product].ProductID);
       case ProductsInstalledArray[product].ProductID of
          IB4Install : result := result + ' Interbase 4' + #13;
          IB5Install : result := result + ' Interbase 5' + #13;
          IB6Install : result := result + ' Interbase 6' + #13;
          IB65Install : result := result + ' Interbase 6.5' + #13;
          IB70Install :result := result + ' Interbase 7' + #13;
          FB1Install  :result := result + ' Firebird 1' + #13;
          FB15RCInstall : result := result + ' Firebird 1.5RC' + #13;
          FB15Install  : result := result + ' Firebird 1.5' + #13;
          FB20Install  : begin
                          result := result + ' Firebird 2.0' + #13
                          FirebirdInstalledRootDir :=  ProductsInstalledArray[product].path;
                        end;
          IB80Install  : result := result + ' Interbase 8' + #13;
          IB81Install  : result := result + ' Interbase 8' + #13;
          FB21Install  : result := result + ' Firebird 2.1' + #13;
          FB21_x64_Install  : result := result + ' Firebird 2.1_x64' + #13;
          FB25Install   : result := result + ' Firebird 2.5' + #13;
          FB25_x64_Install  : result := result + ' Firebird 2.5_x64' + #13;
          FB30Install    : result := result + ' Firebird 3' + #13;
          FB30_x64_Install  : result := result + ' Firebird 3_x64' + #13;
       end;//case
    end;
    end;
    

    等待install_super.bat终止

    [Run]
    Filename: {app}\FB\bin\install_super.bat; WorkingDir: {app}\FB\BIN; Languages: ru; Components: fbserver database; Flags: waituntilterminated
    

    我检查是否安装了Firebird及其版本。如果安装的版本不正确,我会警告用户。如果版本正确,我将继续安装而不安装
    Firebird
    。稍后我会展示代码。请每个问题问一个问题,因为你问的是两个不同的问题,这使得这个问题过于宽泛。这个文件在哪里?我使用Zip工具包中的.exe?以外的其他设置进行手动/自定义安装
    [Run]
    Filename: {app}\FB\bin\install_super.bat; WorkingDir: {app}\FB\BIN; Languages: ru; Components: fbserver database; Flags: waituntilterminated