创新的安装程序:ExtractTemporaryFile导致向导冻结 [英] Inno setup: ExtractTemporaryFile causes wizard freeze
问题描述
我已经制作了自定义页面来管理特定的redist工具的安装,具体取决于用户的选择.
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.
我这里的问题是,仅在完成工具设置的第一个ExtractTemporaryFile后显示进度页面,并显示最后一页,就像冻结了一样.
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.
在ExtractTemporaryFile发生之前,我只需要显示进度页的唯一方法是将MsgBox放在任何安装函数之前. 但是即使在这种情况下,当启动ExtractTemporaryFile时,进度栏动画也会被冻结,直到ExtractTemporaryFile完成...
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 progressbar 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;
请注意 ExtractTemporaryFile()
是在每个F_InstallTooln()
函数中创建的.
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
在这里,直到完成第一个ExtractTemporaryFile之后,才会显示PageInstallationPersonnalisee页面.
Here, the page PageInstallationPersonnalisee is not shown until first ExtractTemporaryFile is done...
我知道 ExtractTemporaryFile 可能会导致安装过程中的某些延迟,但是为什么它会导致向导冻结?
I'm aware that ExtractTemporaryFile can cause some delay in install process, but why should it cause a Wizard freeze?
所以我的问题是:在我的情况下,是否有一种方法可以强制向导刷新,以便在启动任何 ExtractTemporaryFile 过程之前显示向导?
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?
推荐答案
ExtractTemporaryFile
实际上挂起了向导表单.就像大多数代码一样.
The ExtractTemporaryFile
really hangs the wizard form. As most code does.
唯一允许强制Windows消息队列被发送的自定义页面是TOutputProgressWizardPage
(由 CreateOutputProgressPage
).
The only custom page that allows forcing Windows message queue to get pumped is the TOutputProgressWizardPage
(created by the 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
块.
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
这篇关于创新的安装程序:ExtractTemporaryFile导致向导冻结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!