InnoSetup能够实现“安装细节描述”界面吗?

时间:2022-02-24 00:56:32
QUOTE( Example_Test.iss )
// 脚本使用了 增强版脚本编辑器 build 091218:Beta2
// 编译器版本为 5.3.6.ee1

[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma
SolidCompression=yes
OutputDir=userdocs:Inno Setup Examples Output

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; BeforeInstall: AddToDetaList;
Source: "MyProg.chm"; DestDir: "{app}"; BeforeInstall: AddToDetaList;

[ISFormDesigner]
WizardForm=FF0A005457495A415244464F524D0030107702000054504630F10B5457697A617264466F726D0A57697A617264466F726D044C656674020003546F7002000C436C69656E744865696768740366010B436C69656E74576964746803EF010D506978656C73506572496E636802600A54657874486569676874020D00F10C544E65774E6F7465626F6F6B0D4F757465724E6F7465626F6F6B00F110544E65774E6F7465626F6F6B5061676509496E6E65725061676500F10C544E65774E6F7465626F6F6B0D496E6E65724E6F7465626F6F6B00F110544E65774E6F7465626F6F6B506167650E496E7374616C6C696E675061676500F302000E544E6577537461746963546578740B5374617475734C6162656C0756697369626C65080000F202010B544E65774C697374426F7808446574614C697374044C656674020003546F70022C05576964746803A1010648656967687403B9000A4974656D486569676874020D085461624F7264657202040756697369626C65080000F302020E544E6577537461746963546578740D46696C656E616D654C6162656C0756697369626C65080000F10F544E657750726F67726573734261720D50726F6772657373476175676503546F70021200000A544E6577427574746F6E0B53686F774465746142746E044C656674020503546F700230055769647468024B0648656967687402160743617074696F6E12080000003E663A79C67E82822800260044002900085461624F72646572020300000E544E65775374617469635465787409446574614C6162656C044C656674020003546F70020005576964746803A101064865696768740210084175746F53697A65080D53686F77416363656C4368617208085461624F72646572020500000000000000

[Code]
procedure ShowDetaBtnOnClick(Sender: TObject); forward;

{ RedesignWizardFormBegin } // 不要删除这一行代码。
// 不要修改这一段代码,它是自动生成的。
var
DetaList: TNewListBox;
ShowDetaBtn: TNewButton;
DetaLabel: TNewStaticText;

procedure RedesignWizardForm;
begin
with WizardForm.StatusLabel do
begin
  Visible := False;
end;

{ DetaList }
DetaList := TNewListBox.Create(WizardForm);
with DetaList do
begin
  Parent := WizardForm.InstallingPage;
  Left := ScaleX(0);
  Top := ScaleY(44);
  Width := ScaleX(417);
  Height := ScaleY(185);
  ItemHeight := 13;
  TabOrder := 4;
  Visible := False;
end;

with WizardForm.FilenameLabel do
begin
  Visible := False;
end;

with WizardForm.ProgressGauge do
begin
  Top := ScaleY(18);
end;

{ ShowDetaBtn }
ShowDetaBtn := TNewButton.Create(WizardForm);
with ShowDetaBtn do
begin
  Parent := WizardForm.InstallingPage;
  Left := ScaleX(5);
  Top := ScaleY(48);
  Width := ScaleX(75);
  Height := ScaleY(22);
  Caption := '显示细节(&D)';
  TabOrder := 3;
end;

{ DetaLabel }
DetaLabel := TNewStaticText.Create(WizardForm);
with DetaLabel do
begin
  Parent := WizardForm.InstallingPage;
  Left := ScaleX(0);
  Top := ScaleY(0);
  Width := ScaleX(417);
  Height := ScaleY(16);
  AutoSize := False;
  ShowAccelChar := False;
  TabOrder := 5;
end;

{ ReservationBegin }
// 这一部分是提供给你的,你可以在这里输入一些补充代码。
ShowDetaBtn.OnClick := @ShowDetaBtnOnClick;
{ ReservationEnd }
end;
// 不要修改这一段代码,它是自动生成的。
{ RedesignWizardFormEnd } // 不要删除这一行代码。

procedure InitializeWizard();
begin
RedesignWizardForm;
end;

procedure ShowDetaBtnOnClick(Sender: TObject);
begin
ShowDetaBtn.Visible := False;
DetaList.Visible := True;
end;

procedure AddToDetaList;
begin         
DetaLabel.Caption := '安装: ' + ExpandConstant(CurrentFileName);
DetaList.Items.Append(DetaLabel.Caption); 

//滚动
DetaList.ItemIndex := DetaList.Items.Count - 1;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpFinished then
begin
  // 跳回前一页,忽略完成页。 
  DetaList.Items.Append('安装完成'); 
  WizardForm.PageNameLabel.Caption := '安装完成';
  WizardForm.PageDescriptionLabel.Caption := '安装程序已经成功完成安装。';
  DetaLabel.Caption := '完成';
  WizardForm.InnerNotebook.ActivePage := WizardForm.InstallingPage;
  WizardForm.OuterNotebook.ActivePage := WizardForm.InnerPage;
end;
end;