Inno Setup ExtractTemporaryFile导致向导冻结 [英] Inno Setup ExtractTemporaryFile causes wizard to freeze

查看:165
本文介绍了Inno Setup ExtractTemporaryFile导致向导冻结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

这些工具链接到用户是否想要安装这些工具的复选框.然后仅出现一个页面,向用户显示每个工具的安装进度.

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

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

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

 过程CurPageChanged(CurPageID:Integer);开始如果CurPageID = PageInstallationPersonnalisee.ID,则开始ProgressBarLabelPageInstPerso.Caption:='正在初始化...';如果InstallTool1 = True,则开始ProgressBarLabelPageInstPerso.Caption:='正在安装InstallTool1 ...';F_InstallTool1();结尾;如果InstallTool2 = True,则开始ProgressBarLabelPageInstPerso.Caption:='正在安装InstallTool2 ...';F_InstallTool2();结尾;如果InstallTool3 = True,则开始ProgressBarLabelPageInstPerso.Caption:='正在安装InstallTool3 ...';F_InstallTool3();结尾;ProgressBarPageInstPerso.Style:= npbstMarquee;//ProgressBarPageInstPerso.Style:= npbstNormal;ProgressBarPageInstPerso.Position:= 100;CancelWithoutPrompt:=正确;WizardForm.Close;结尾;结尾; 

请注意,在每个 F_InstallTooln()函数中都创建了 ExtractTemporaryFile().

设置和文件部分的其他部分可能会帮助您

 <代码> [设置]SolidCompression =否[档案];临时红手来源:"{#MyRessourcesPath} InstallTool1_Setup.exe";DestDir:"{tmp}";\标志:删除后安装noencryption dontcopy来源:"{#MyRessourcesPath} InstallTool2_Setup.exe";DestDir:"{tmp}";\标志:删除后安装noencryption dontcopy来源:"{#MyRessourcesPath} InstallTool3_Setup.exe";DestDir:"{tmp}";\标志:删除后安装noencryption dontcopy 

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

我知道 ExtractTemporaryFile 会导致安装过程中的某些延迟,但是为什么它会导致向导冻结?

所以我的问题是:在我的情况下,是否有一种方法可以强制向导刷新,以便在启动任何 ExtractTemporaryFile 过程之前显示向导?

解决方案

ExtractTemporaryFile 确实挂起了向导表单.就像大多数代码一样.

允许强制发送Windows消息队列的唯一自定义页面是 TOutputProgressWizardPage (由 函数NextButtonClick(CurPageID:Integer):布尔值;变种ProgressPage:TOutputProgressWizardPage;开始如果CurPageID = wpReady然后开始ProgressPage:= CreateOutputProgressPage('正在准备安装','');ProgressPage.Show;尝试ProgressPage.Msg1Label.Caption:='正在安装1 ...';ProgressPage.SetProgress(0,100);ExtractTemporaryFile('1.exe');执行(...);ProgressPage.Msg1Label.Caption:='正在安装2 ...';ProgressPage.SetProgress(33,100);ExtractTemporaryFile('2.exe');执行(...);ProgressPage.Msg1Label.Caption:='正在安装3 ...';ProgressPage.SetProgress(66,100);ExtractTemporaryFile('3.exe');执行(...);ProgressPage.SetProgress(100,100);ProgressPage.Hide;最后结尾;结尾;结果:= True;结尾;

尽管在带有带有动画效果的进度条的现代Windows版本中,它都不能很好地工作,但是如果您不能经常调用 SetProgress 的话.请注意, SetProgress 调用是将消息队列泵送到后台的方法.因此,即使其参数未更改也可以调用它.但是您不能,因为 ExtractTemporaryFile 块.


或者,您可以将部署留在 [Files] 部分,并让安装程序从

I've made custom pages to manage specific redist tools install depending on the user choice.

Those tools are linked to checkboxes checked by the user if he wants or not install those tools. Then come a page only there to show the user the progression of the installation of each tool.

The issue I have here is that the progress page is shown only when first ExtractTemporaryFile of the setups for the tools is done, showing the last page as if it has frozen.

The only way I have to let the progress page be shown before the ExtractTemporaryFile happens is to put a MsgBox before any install function. But even in this case, when the ExtractTemporaryFile is launched, the progress bar animation is frozen until the ExtractTemporaryFile is done...

Here is the part of the code doing this:

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;

Note that ExtractTemporaryFile() is made in each F_InstallTooln() function.

Others part of Setup and File Sections that could help:

[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

Here, the page PageInstallationPersonnalisee is not shown until first ExtractTemporaryFile is done...

I'm aware that ExtractTemporaryFile can cause some delay in install process, but why should it cause the wizard to freeze?

So my question is: in my scenario, is there a way to force the wizard refreshing so that he shows up before any ExtractTemporaryFile procedure is launched?

解决方案

The ExtractTemporaryFile really hangs the wizard form. As most code does.

The only custom page that allows forcing Windows message queue to get pumped is the TOutputProgressWizardPage (created by the CreateOutputProgressPage).

You can do something like this:

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;

Though it does not work really well either on modern versions of Windows that have fancy progress bar with animation, if you cannot call the SetProgress frequently. Note that the SetProgress call is what does pump the message queue behind the scenes. So it makes sense to call it even when its parameter do not change. But you cannot, as the ExtractTemporaryFile blocks.


Alternatively, you can leave the deployment to the [Files] section and have the installers be executed from the 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

这篇关于Inno Setup ExtractTemporaryFile导致向导冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆