【问题标题】:How can I prevent showing the splash screen when I need it in Inno Setup?在 Inno Setup 中需要时如何防止显示启动画面?
【发布时间】:2020-04-06 13:53:55
【问题描述】:

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

【问题讨论】:

    标签: installation inno-setup splash-screen pascalscript issi


    【解决方案1】:

    使用 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的文档:

    • 将按照定义的顺序调用实现,除了任何主实现(=没有事件属性的实现)将被最后调用

    • 如果事件函数有返回值,则执行惰性求值: InitializeSetupBackButtonClickNextButtonClickInitializeUninstall

      • 所有实现都必须返回 True,事件函数才会被视为返回 True,返回 False 的实现会停止对其他实现的调用。

    【讨论】:

    • 这真的很有帮助!谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-29
    • 1970-01-01
    • 2022-08-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多