-1

I'm having a step that restores databases for my application and I'm currently handling it in the AfterInstall function of my exe's Run section.

The Progress bar only shows the file extraction process after which it displays Finishing message.

I'd like to update this progress Bar to show Database restoration step covering 50 percent of the overall installation progress

I tried manipulating the progress bar within my Database restore procedure called in AfterInstall parameter, as per Inno Setup: How to manipulate progress bar on Run section? and Inno Setup - Prevent extraction of files from setting progress bar to 100% but the progress bar stopped working.

Any suggestions are highly appreciated, Thanks in advance.

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
deepika
  • 7
  • 3
  • 1
    You probably block the Windows message loop in your `AfterInstall` code, so the progress does not draw. But hard to tell, as you didn't post [mcve]. – Martin Prikryl Nov 22 '22 at 06:25

1 Answers1

-1

Instead of using "AfterInstall" to restore your database, do it during the CurStepChanged event handler. If you put this procedure in your [code] section it will run pre-install and post-install and you just have to check that its post instal before restoring your database. This happens before the "AfterInstall" and will still update the progress bar.

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then   //directly after the application installs
  begin
    [your code here for restoring database]
  end;
end;
  • Imo, OP's code blocks the message pump. It won't make any difference if you run the same code from another event function. It will still block. – Martin Prikryl Dec 07 '22 at 06:34