You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Inno Setup:wpPreparing页面星号来源及自定义替换问询

Inno Setup wpPreparing页面未知星号的来源与替换方案

星号的来源

这个星号是Inno Setup内置的进度状态提示后缀,当安装进入准备阶段(wpPreparing对应ssInstall步骤前后),程序会自动在StatusLabel的文本末尾追加*,用来标识后台正在执行准备操作。该内容属于程序内部硬编码的动态标识,不会出现在ISL语言文件或[CustomMessages]节中。

定位与替换方法

由于星号是动态追加的,常规日志只能捕获最终的Caption内容,无法追踪追加过程,你可以通过以下两种方式处理:

方法一:实时替换默认标签文本

在CurStepChanged事件中,针对ssInstall步骤(对应wpPreparing页面),直接替换星号或覆盖原有状态文本:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    // 方式1:替换文本中的星号为自定义内容
    WizardForm.StatusLabel.Caption := StringReplace(WizardForm.StatusLabel.Caption, '*', '(准备中)', [rfReplaceAll]);
    // 方式2:直接设置自定义状态文本,完全覆盖原有内容
    // WizardForm.StatusLabel.Caption := '正在准备安装资源,请稍候...';
  end;
end;

方法二:用自定义控件替代默认标签

如果需要更彻底的控制权,可以隐藏默认的StatusLabel,创建自定义标签来展示状态:

var
  CustomStatusLabel: TLabel;

procedure InitializeWizard();
begin
  // 创建自定义状态标签,对齐默认标签的位置
  CustomStatusLabel := TLabel.Create(WizardForm);
  CustomStatusLabel.Parent := WizardForm;
  CustomStatusLabel.Left := WizardForm.StatusLabel.Left;
  CustomStatusLabel.Top := WizardForm.StatusLabel.Top;
  CustomStatusLabel.Width := WizardForm.StatusLabel.Width;
  CustomStatusLabel.Height := WizardForm.StatusLabel.Height;
  // 隐藏默认的状态标签
  WizardForm.StatusLabel.Visible := False;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    CustomStatusLabel.Caption := '正在准备安装,请稍候...';
  end
  else
  begin
    CustomStatusLabel.Caption := '';
  end;
end;

内容的提问来源于stack exchange,提问作者pburgr

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.24 11:05:05