我是Inno Setup的新手,很难找到这个答案......
我在安装程序中包含了一个DirectX9安装文件,但我想向用户显示一个MessageBox,询问“你想安装DirectX9吗?”这是在我的游戏的常规安装之前完成的...如果他说是,那么我想运行我包含的这个附加文件,否则只是继续安装游戏。
答案 0 :(得分:4)
以下代码将在安装开始之前运行。它要求用户确认,然后运行“InstallDirectX.exe”(必须安装程序可用)。
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: integer;
begin
if (msgbox('Do you want to install DirectX ?', mbConfirmation, MB_YESNO) = IDYES) then
begin
if Exec(ExpandConstant('InstallDirectX.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
// handle success if necessary; ResultCode contains the exit code
MsgBox('Everything is proceeding according to plan', mbInformation, MB_OK);
end
else
begin
// handle failure if necessary; ResultCode contains the error code
MsgBox('Something went horribly wrong', mbError, MB_OK);
end;
end;
end;
答案 1 :(得分:3)
如果要在安装完成后显示消息框,可以使用以下代码:
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
begin
if CurStep = ssPostInstall then
begin
if (msgbox('Do you want to install DirectX ?', mbConfirmation, MB_YESNO) = IDYES) then
begin
if Exec(ExpandConstant('{src}\dxwebsetup.exe'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('Installing DirectX completed', mbInformation, MB_OK);
end
else
begin
MsgBox('Installing Error', mbError, MB_OK);
end;
end;
end;
end;