Inno Setup - 卸载时进度条不显示

4
我正在使用Inno Setup创建自己的安装程序。当用户卸载应用程序时,我想要删除一些文件夹。因此,我使用CurUninstallStepChanged事件来删除文件夹,并使用npbstMarquee样式显示"进度条"(基于Inno Setup: How to handle progress bar on [UninstallDelete] section?)。
以下是代码:
procedure DeleteFolder();
var
  FindRec: TFindRec;
  fullPath: string;
  tmpMsg: string;
  StatusText: string;
  deletePath: string;
begin
  { find all and delete }
  UninstallProgressForm.ProgressBar.Style := npbstMarquee;       
  StatusText := UninstallProgressForm.StatusLabel.Caption;
  UninstallProgressForm.StatusLabel.WordWrap := True;
  UninstallProgressForm.StatusLabel.AutoSize := True;
  fullPath := 'C:\ProgramData\TestPath';
  if FindFirst(ExpandConstant(fullPath + '\*'), FindRec) then 
  try
    repeat
      if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and 
         (FindRec.Name <> '.') and (FindRec.Name <> '..') then begin
            deletePath := AddBackslash(fullPath) + FindRec.Name;
            tmpMsg := 'Deleting...' + #13#10 + deletePath;
            UninstallProgressForm.StatusLabel.Caption := tmpMsg;
            DelTree(deletePath, True, True, True);
        end;
    until
      not FindNext(FindRec);
  finally
    UninstallProgressForm.StatusLabel.Caption := StatusText;
    FindClose(FindRec);
  end;
  UninstallProgressForm.ProgressBar.Style := npbstNormal;
end;

{ Uninstall event }
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
   case CurUninstallStep of
    usUninstall:
     begin
       DeleteFolder();
    end;
  end;
end;

如果我逐行调试,我可以看到进度条正在运行。但是当我使用 unins000.exe 时,只有 Caption 可以显示,进度条没有显示。
我该如何修复它?

1个回答

4

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接