diff --git a/Projects/Src/Setup.WizardForm.pas b/Projects/Src/Setup.WizardForm.pas index eca49435..d786dbdb 100644 --- a/Projects/Src/Setup.WizardForm.pas +++ b/Projects/Src/Setup.WizardForm.pas @@ -211,6 +211,7 @@ TWizardForm = class(TSetupForm) procedure UpdatePage(const PageID: Integer); procedure UpdateSelectTasksPage; procedure WMSysCommand(var Message: TWMSysCommand); message WM_SYSCOMMAND; + procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING; public { Public declarations } PrepareToInstallFailureMessage: String; @@ -2684,6 +2685,22 @@ procedure TWizardForm.WMSysCommand(var Message: TWMSysCommand); inherited; end; +procedure TWizardForm.WMWindowPosChanging(var Message: TWMWindowPosChanging); +begin + { Work around a VCL issue (Delphi 11.3) when MainFormOnTaskBar=True: + If Application.Restore is called while the main form is hidden + (Visible=False), the window can become visible because of the SW_RESTORE + command it uses, which both unminimizes and shows a window. Reproducer: + Application.Minimize; + Hide; + Application.Restore; + This blocks any attempt to show the window while Visible=False. + (SW_RESTORE will still unminimize the window; it just cannot show it.) } + inherited; + if not Visible then + Message.WindowPos.flags := Message.WindowPos.flags and not SWP_SHOWWINDOW; +end; + procedure TWizardForm.LicenseAcceptedRadioClick(Sender: TObject); begin if CurPageID = wpLicense then