我正在使用Inno设置来提供软件包.它会检测Access的版本并弹出消息.我想让消息告诉用户他们已经下载了错误的版本并停止安装.目前Inno脚本使用
itd_downloadafter(NoRuntimePage.ID);
Run Code Online (Sandbox Code Playgroud)
显示一条消息,告诉用户他们需要安装AccessRuntime.当用户按下它时,它会下载AccessRuntime并继续.我想为我的新脚本更改此信息,告诉用户他们有错误的版本,然后在他们按下一个或只是取消时结束安装脚本.任何人都可以帮我解决这个问题吗?
为什么要使用InitializeSetup?
如果要在向导启动之前有条件地退出设置,请不要使用异常引发的InitializeWizard
事件功能Abort
.你会浪费你的时间,需要创建整个向导表单.请改用InitializeSetup
事件功能.在那里你可以引发Abort
异常或者更好地将False返回到它的布尔结果,并按原样退出函数 - 最终效果肯定是一样的.
在内部,当您从脚本返回False时,该InitializeSetup
函数仅引发此Abort
异常.与InitializeWizard
事件相反,当InitializeSetup
事件被触发时,尚未创建向导表单,因此您不会浪费时间从不使用系统资源.
代码示例:
在下面的伪代码中你需要有一个像UserDownloadedWrongVersion
where 的函数,如果你返回True,设置将被终止,没有任何反应.
[Code]
function UserDownloadedWrongVersion: Boolean;
begin
// make your check here and return True when you detect a wrong
// version, what causes the setup to terminate; False otherwise
end;
function InitializeSetup: Boolean;
begin
Result := not UserDownloadedWrongVersion;
if not Result then
begin
MsgBox('You''ve downloaded the wrong version. Setup will now exit!',
mbError, MB_OK);
Exit; // <-- or use Abort; instead, but there's no need for panic
end;
end;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3437 次 |
最近记录: |