installation - 在 Inno Setup 中需要时如何防止显示启动画面?
问题描述
如何在需要时防止显示启动画面?我应该添加一些 ISSI 代码来做到这一点吗?
这是我的代码:
#define ISSI_Splash "C:\InnoSetupProject\Images\client.bmp"
#define ISSI_Splash_T 3
#define ISSI_Splash_X 500
#define ISSI_Splash_Y 220
[Code]
function ISSI_InitializeSetup : Boolean;
begin
Result := True;
if not RegValueExists(HKLM, 'SOFTWARE\MyApp\Client', 'LocaleID') then
if MsgBox('Client does not exist', mbCriticalError, MB_OK) = IDOK then
begin
Result := False;
{ How can I prevent showing the splash screen here? }
Exit;
end
end;
#define ISSI_InitializeSetup
#define ISSI_IncludePath "C:\ISSI"
#include ISSI_IncludePath+"\_issi.isi"
解决方案
代替旧ISSI_InitializeSetup
功能,使用 Inno Setup 6事件属性:
[Code]
<event('InitializeSetup')>
function MyInitializeSetup: Boolean;
begin
Result := True;
if not RegValueExists(HKLM, 'SOFTWARE\MyApp\Client', 'LocaleID') then
if MsgBox('Client does not exist', mbCriticalError, MB_OK) = IDOK then
begin
Result := False;
end;
end;
并删除它:
#define ISSI_InitializeSetup
将MyInitializeSetup
在 ISSI 之前调用InitializeSetup
。如果它返回False
,则永远不会调用 ISSI,因此不会显示启动画面。
检查事件属性的文档:
实现将按其定义的顺序被调用,除了任何主要实现(=没有事件属性的实现)将被最后调用。
如果事件函数有返回值,则执行惰性求值:
InitializeSetup
,BackButtonClick
,NextButtonClick
,InitializeUninstall
:
- 所有实现都必须返回 True 才能将事件函数视为返回 True,并且返回 False 的实现会停止对其他实现的调用。
推荐阅读
- android - 如何在gridlayout或gridview中放置动态arraylist按钮
- c++ - 访问类的私有成员(C++)
- javascript - 如何在 Woocommerce 的 ajax 事件后运行 jQuery 函数
- css - 在 google chrome 中带有 flex 按钮标签的 alight-item 不起作用
- dialogflow-es - Dialogflow,从单个输入设置两个参数
- php - 如何在已删除的小部件上禁用 @Assert 验证
- python - 带有 NVidia GPU 的 TensorFlow 2.1 返回警告和错误:缺少库、NUMA、卷积操作
- javascript - AWS Elastic Beanstalk : How to change node command ? Container Options removed in recent update?
- c++ - 如何将 'this' 变成 std::unique_ptr?
- dosbox - 如何在 DosBox 的窗口中启用快速编辑模式?