Skip to content

Commit

Permalink
Check if WizardForm is minimized before calling Application.BringToFr…
Browse files Browse the repository at this point in the history
…ont.


Works around VCL bug. If Application.BringToFront is called while the app is minimized, the Forms unit's WM_ACTIVATEAPP handler inexplicably sets FAppIconic=False, which causes the next Application.Restore call to be a no-op.
  • Loading branch information
jordanrussell authored Dec 18, 2024
1 parent f6f2f17 commit 5e6334e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Projects/Src/Setup.MainForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ function TMainForm.Install: Boolean;
NeedsRestart := True;
end;
end;
Application.BringToFront;
if WizardForm.WindowState <> wsMinimized then { VCL bug workaround }
Application.BringToFront;
end;
end;

Expand All @@ -239,7 +240,8 @@ function TMainForm.Install: Boolean;
finally
WindowDisabler.Free;
end;
Application.BringToFront;
if WizardForm.WindowState <> wsMinimized then { VCL bug workaround }
Application.BringToFront;

if Error = ERROR_FAIL_RESTART then
Log('One or more applications could not be restarted.')
Expand Down
3 changes: 2 additions & 1 deletion Projects/Src/Setup.WizardForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,8 @@ function TWizardForm.PrepareToInstall(const WizardComponents, WizardTasks: TStri
DownloadTemporaryFileOrExtract7ZipArchiveProcessMessages := False;
UpdateCurPageButtonState;
end;
Application.BringToFront;
if WindowState <> wsMinimized then { VCL bug workaround }
Application.BringToFront;
end;
if Result <> '' then begin
if PrepareToInstallNeedsRestart then
Expand Down

0 comments on commit 5e6334e

Please sign in to comment.