jwz104
jwz104

Reputation: 367

Hide form2 from taskbar

I want to hide form2 from the taskbar but i don't know how.
I do know how to hide the main form:

application.MainFormOnTaskBar := false;

But how can i hide form2 from the taskbar?

Upvotes: 0

Views: 182

Answers (1)

David Heffernan
David Heffernan

Reputation: 613441

In what follows, by ownership I refer to the Windows concept rather than the Delphi concept.

Unowned top level windows have buttons on the taskbar. By setting MainFormOnTaskbar to False you make the main form be owned by the application window. And the taskbar button is associated with the application window. You are hiding that button by hiding the application window.

If the secondary form has a button on the taskbar it presumably has no owner. That won't happen by default so one assumes you are setting WndParent to 0 in CreateParams. Or using PopupParent to achieve the same.

Since owned windows don't show up on the taskbar, and since it appears that you don't want the secondary form to be owned by the main form, it seems that you need to make the secondary form be owned by the application window.

Even if my guesswork above is off, the fact remains that the way to keep a window from having a taskbar button is to give it an owner.

Upvotes: 1

Related Questions