Inno Setup-防止提取文件,将进度条设置为100% [英] Inno Setup - Prevent extraction of files from setting progress bar to 100%

查看:261
本文介绍了Inno Setup-防止提取文件,将进度条设置为100%的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Inno Setup wpInstalling页面中,如何防止将[Files]部分中定义的文件的初始提取设置为进度条设置为(几乎)100%?

In the Inno Setup wpInstalling page how can I prevent the initial extraction of the files as defined in the [Files] section from setting the progress bar to (almost) 100%?

我的安装脚本主要包括从"[运行]"部分安装许多第三方安装文件.下面的示例:

My installation script mainly consists of installing a number of third party installation files from the '[Run]' section. Example below:

[Run]
Filename: "{tmp}\vcredist_x86-2010-sp1.exe"; Parameters: "/q /norestart"; Check: InstallVCRedist;  BeforeInstall: UpdateProgress(10, 'Installing Microsoft Visual C++ 2010 x86 Redistributable - 10.0.40219...');
Filename: "{tmp}\openfire_3_8_1.exe"; Check: InstallOpenFire; BeforeInstall: UpdateProgress(25, 'Installing OpenFire 3.8.1...');
Filename: "{tmp}\postgresql-8.4.16-2-windows.exe"; Parameters: "--mode unattended --unattendedmodeui none --datadir ""{commonappdata}\PostgreSQL\8.4\data"" --install_runtimes 0"; Check: InstallPostgreSQL;  BeforeInstall: UpdateProgress(35, 'Installing PostgreSQL 8.4...'); AfterInstall: UpdateProgress(50, 'Setting up database...');

这些第三方组件的安装要比安装的任何其他部分花费更长的时间(到目前为止),但是不幸的是,在最初提取这些文件的过程中,进度条从0%变为接近100%.然后,我可以使用以下过程将进度条重置为自己选择的数量:

The installation of these third party components takes longer than any other part of the install (by far) but unfortunately the progress bar goes from 0% to close to 100% during the initial extraction of these files. I then can reset the progress bar to an amount of my choosing by using the following procedure:

procedure UpdateProgress(Position: Integer; StatusMsg: String);
begin
  WizardForm.StatusLabel.Caption := StatusMsg;
  WizardForm.ProgressGauge.Position := Position * WizardForm.ProgressGauge.Max div 100;
end;

但是理想情况下,我希望初始提取值从0-10%(大约)开始,因为这样可以更准确地表示实际发生的情况.

Ideally however I'd prefer the initial extraction to instead go from 0-10% (approx) as that would more closely represent what is actually happening.

是否有任何事件可以捕获文件提取的进度,或者是一种防止或阻止文件提取更新进度条的方式?

Is there any event to capture the progression of the extraction of the files or alternatively a way to prevent or block the extraction of the files from updating the progress bar?

推荐答案

您必须增加WizardForm.ProgressGauge.Max.

但是不幸的是,在Inno Setup设置其初始最大值后,没有任何事件发生.

But unfortunately there's no event that happens after the Inno Setup sets its initial maximum.

您可以滥用第一个已安装文件的 BeforeInstall参数但是.

You can abuse the BeforeInstall parameter of the first installed file though.

,然后在[Run]部分中,使用AfterInstall前进进度条.

And then in the [Run] section, use the AfterInstall to progress the bar.

这扩展了我对 Inno设置:如何在运行"部分上操作进度条的答案?

[Files]
Source: "vcredist_x86-2010-sp1.exe"; DestDir: "{tmp}"; BeforeInstall: SetProgressMax(10)
Source: "openfire_3_8_1.exe"; DestDir: "{tmp}"; 

[Run]
Filename: "{tmp}\vcredist_x86-2010-sp1.exe"; AfterInstall: UpdateProgress(55);
Filename: "{tmp}\openfire_3_8_1.exe"; AfterInstall: UpdateProgress(100);

[Code]

procedure SetProgressMax(Ratio: Integer);
begin
  WizardForm.ProgressGauge.Max := WizardForm.ProgressGauge.Max * Ratio;
end;

procedure UpdateProgress(Position: Integer);
begin
  WizardForm.ProgressGauge.Position := Position * WizardForm.ProgressGauge.Max div 100;
end;

这篇关于Inno Setup-防止提取文件,将进度条设置为100%的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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