linxinfa/Beautiful-InnoSetup-Demo

生成的安装包,进度条非常慢

Opened this issue · 2 comments

MakePCSetup.iss 这个调哪个参数可以让其进度条加快

同问

lhqm commented

同问

一个行之有效的方法是,在function PBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;中,对pos:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min; total:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;这两个操作加以次数限制。repo_owner的做法是 完全不加以限制,导致进度条更新操作完全取决于设备性能,因为这两个操作是Windows询问操作,非常耗时,所以说导致了你的安装程序啥也不干,光询问进度去了。如果你不了解这个脚本和settimer的用法,只需要定义一个全局变量skip,然后将代码改写为:

function PBProc(h:hWnd;Msg,wParam,lParam:Longint):Longint;
var
  pos,total: Longint;
  pr: Extended;
  w : integer;
begin
  Result:=CallWindowProc(PBOldProc,h,Msg,wParam,lParam);
  //Log(IntToStr(Msg));
  if (Msg=$402) and (WizardForm.ProgressGauge.Position>WizardForm.ProgressGauge.Min) and (skip>=20) then
  begin
    skip:=0;
    pos:=WizardForm.ProgressGauge.Position-WizardForm.ProgressGauge.Min;
    total:=WizardForm.ProgressGauge.Max-WizardForm.ProgressGauge.Min;
    //Log(Format('%d %d', [pos, total]));
    pr:=(pos as Extended)/(total as Extended)*100;
    PageInstall_SetProgress(pr);
    Notify_DoNotifyProgress(pos, total);
  end;
  skip:=skip+1;
end;