【问题标题】:Inno Setup ExtractTemporaryFile causes wizard to freezeInno Setup ExtractTemporaryFile 导致向导冻结
【发布时间】:2017-01-09 14:16:51
【问题描述】:

我已经制作了自定义页面来管理特定的 redist 工具安装,具体取决于用户的选择。

如果用户想要或不安装这些工具,这些工具会链接到用户选中的复选框。 然后只在那里出现一个页面,向用户显示每个工具的安装进度。

我在这里遇到的问题是进度页面仅在工具设置的第一个ExtractTemporaryFile 完成时显示,显示最后一页好像它已冻结。

ExtractTemporaryFile 发生之前,我必须让进度页面显示的唯一方法是在任何安装功能之前放置一个MsgBox。 但即使在这种情况下,当ExtractTemporaryFile 启动时,进度条动画也会冻结,直到ExtractTemporaryFile 完成...

这是执行此操作的代码部分:

procedure CurPageChanged(CurPageID: Integer);
begin
  If CurPageID=PageInstallationPersonnalisee.ID then
    begin
      ProgressBarLabelPageInstPerso.Caption := 'Initialisation...';
      if InstallTool1 = True then
        begin
          ProgressBarLabelPageInstPerso.Caption := 'Installing InstallTool1...';
          F_InstallTool1();
        end;
      if InstallTool2 = True then
        begin
          ProgressBarLabelPageInstPerso.Caption := 'Installing InstallTool2...';
          F_InstallTool2();
        end;
      if InstallTool3 = True then
        begin
          ProgressBarLabelPageInstPerso.Caption := 'Installing InstallTool3...';
          F_InstallTool3();
        end;

      ProgressBarPageInstPerso.Style := npbstMarquee;
      //ProgressBarPageInstPerso.Style := npbstNormal;
      ProgressBarPageInstPerso.Position := 100;

      CancelWithoutPrompt:=True;
      WizardForm.Close;
    end;
end;

请注意,ExtractTemporaryFile() 是在每个 F_InstallTooln() 函数中生成的。

设置和文件部分的其他部分可能会有所帮助:

[Setup]
SolidCompression=no

[Files]
;Temporary redists
Source: "{#MyRessourcesPath}InstallTool1_Setup.exe"; DestDir: "{tmp}"; \
  Flags: deleteafterinstall noencryption dontcopy
Source: "{#MyRessourcesPath}InstallTool2_Setup.exe"; DestDir: "{tmp}"; \
  Flags: deleteafterinstall noencryption dontcopy
Source: "{#MyRessourcesPath}InstallTool3_Setup.exe"; DestDir: "{tmp}"; \
  Flags: deleteafterinstall noencryption dontcopy

在这里,页面PageInstallationPersonnalisee 直到第一个ExtractTemporaryFile 完成后才会显示...

我知道ExtractTemporaryFile 可能会导致安装过程出现一些延迟,但为什么会导致向导冻结?

所以我的问题是:在我的场景中,有没有办法强制向导刷新,以便他在任何ExtractTemporaryFile 程序启动之前出现?

【问题讨论】:

    标签: installation inno-setup freeze pascalscript


    【解决方案1】:

    ExtractTemporaryFile 真的挂了向导表单。和大多数代码一样。

    唯一允许强制 Windows 消息队列被抽取的自定义页面是 TOutputProgressWizardPage(由 CreateOutputProgressPage 创建)。

    你可以这样做:

    function NextButtonClick(CurPageID: Integer): Boolean;
    var
      ProgressPage: TOutputProgressWizardPage;
    begin
      if CurPageID = wpReady then
      begin
        ProgressPage := CreateOutputProgressPage('Preparing installations', '');
        ProgressPage.Show;
        try
          ProgressPage.Msg1Label.Caption := 'Installing 1 ...';
          ProgressPage.SetProgress(0, 100);
          ExtractTemporaryFile('1.exe');
          Exec(...);
    
          ProgressPage.Msg1Label.Caption := 'Installing 2 ...';
          ProgressPage.SetProgress(33, 100);
          ExtractTemporaryFile('2.exe');
          Exec(...);
    
          ProgressPage.Msg1Label.Caption := 'Installing 3 ...';
          ProgressPage.SetProgress(66, 100);
          ExtractTemporaryFile('3.exe');
          Exec(...);
    
          ProgressPage.SetProgress(100, 100);
          ProgressPage.Hide;
        finally
        end;
      end;
      Result := True;
    end;
    

    虽然它在现代版本的 Windows 上都不能很好地工作,如果你不能经常调用 SetProgress 的话。请注意,SetProgress 调用是在幕后抽取消息队列的原因。所以即使它的参数没有改变,调用它也是有意义的。但是你不能,因为 ExtractTemporaryFile 会阻止。


    或者,您可以将部署留给[Files] 部分,并从AfterInstall event 执行安装程序。

    [Files]
    ;Temporary redists
    Source: "{#MyRessourcesPath}InstallTool1_Setup.exe"; DestDir: "{tmp}"; \
      Flags: deleteafterinstall noencryption dontcopy; AfterInstall: Install1
    Source: "{#MyRessourcesPath}InstallTool2_Setup.exe"; DestDir: "{tmp}"; \
      Flags: deleteafterinstall noencryption dontcopy; AfterInstall: Install2
    Source: "{#MyRessourcesPath}InstallTool3_Setup.exe"; DestDir: "{tmp}"; \
      Flags: deleteafterinstall noencryption dontcopy; AfterInstall: Install3
    

    【讨论】:

      【解决方案2】:

      我知道这是一个旧线程,但我遇到了类似的情况,我使用 ExtractTemporaryFile 函数提取的一些文件比其他文件慢得多。

      经过一番调查,我在Inno Setup help pages 上发现了这个:

      启用固态压缩后,请务必在 [Files] 部分的顶部(或附近)列出您的临时文件。为了在固态压缩安装中提取任意文件,安装程序必须首先解压缩所有以前的文件(到内存中的临时缓冲区)。如果 [Files] 部分的指定文件上方列出了许多其他文件,这可能会导致大量延迟。

      这意味着为了获得最佳性能,您应该将要使用该功能提取的文件移动到[Files] 部分的顶部

      【讨论】:

        猜你喜欢
        • 2013-11-29
        • 2013-10-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多