Skip to content

Commit

Permalink
Don't allow Application.Restore to show WizardForm if it's hidden.
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanrussell authored Dec 19, 2024
1 parent f1d03c2 commit 3dc9943
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Projects/Src/Setup.WizardForm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3dc9943

Please sign in to comment.