installation - 当我在 Inno Setup 中需要时,如何防止显示启动屏幕?

标签 installation inno-setup splash-screen pascalscript issi

如何防止在需要时显示启动屏幕? 我应该添加一些 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"

最佳答案

使用 Inno Setup 6 event attributes,而不是旧版 ISSI_InitializeSetup 函数:

[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 将永远不会被调用,因此不会显示启动屏幕。

查看 Event Attributes 的文档:

  • The implementations will be called in order of their definition except that any main implementation (=the implementation without an event attribute) will be called last.

  • If the event function has a return value then lazy evaluation is performed: InitializeSetup, BackButtonClick, NextButtonClick, InitializeUninstall:

    • All implementations must return True for the event function to be treated as returning True and an implementation returning False stops the calls to the other implementations.

关于installation - 当我在 Inno Setup 中需要时,如何防止显示启动屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61061439/

相关文章:

使用 Inno Setup 安装时,Python/Qt/SQLite3 应用程序不运行

ant - ANT 可以参数化 InnoSetup 脚本吗?

inno-setup - 用 Inno Setup 中 setup 子文件夹中的文件覆盖已安装的文件

java - Android 在关闭时退出应用程序

python - 在 Windows 8 上安装 Google Cloud SDK 时遇到问题

ruby - 无法解决 Ruby 错误(缺少心理)

ubuntu - 当我在 ubundu12.04 中运行 'phantomjs' 命令时出现段错误(核心转储)

ios - 如何根据特定用户动态更改启动画面?

c# - 单色触摸 : Loading screen

Python 3.x - 如何获取用户安装包的目录