我正在尝试使用Inno安装程序安装firebird和我的应用程序,但我有两个问题无法解决:
"An existing firebird xxx server is running. You must close the application or stop the service before continuing"。如果您已经安装了Firebird,如何忽略它?我试了几个旗子,留了更多的留言。如何解决这两个问题?
发布于 2015-07-13 09:04:51
为了防止消息“现有的firebird xxx服务器正在运行.”在InitializeSetup中,您可以检查Firebird服务器是否正在运行及其版本。如果它正在运行,并且安装的版本不正确,您可能会做一些事情。
(停止分期付款,或继续分期付款而不安装Firebird或其他东西)。
如何做
首先,您应该找到并下载以下文件:
FirebirdInstallSupportFunctions.inc
CheckIbaseFirebirdInstaled.inc
并将它们包括在代码部分:
[Code]
.....
#include "FirebirdInstallSupportFunctions.inc"
#include "CheckIbaseFirebirdInstaled.inc"
.....在InitializeSetup中:
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;更新
在InitializeWizard中,可以使用InstallSqlServer变量显示或隐藏“安装火鸟页面”,如下所示:
procedure InitializeWizard;
begin
CreateActionSelectPage;
end;
procedure CreateActionSelectPage;
begin
ActionPage := CreateInputOptionPage(wpWelcome,
CustomMessage('ActionPageName'),
CustomMessage('ActionPageDescription'),
CustomMessage('ActionPageMsg'),
False, False);
ActionPage.Add(CustomMessage('InstallSQLSvr'));
ActionPage.Add(CustomMessage('InstallDatabase'));
ActionPage.Add(CustomMessage('InstallClientProgram'));
ActionPage.Values[0] := InstallSQLServer;
ActionPage.Values[1] := True;
ActionPage.Values[2] := True;
end;发布于 2015-07-13 10:48:25
等待install_super.bat终止
[Run]
Filename: {app}\FB\bin\install_super.bat; WorkingDir: {app}\FB\BIN; Languages: ru; Components: fbserver database; Flags: waituntilterminatedhttps://stackoverflow.com/questions/31368271
复制相似问题