1

I asked this question "ActiveX pop-up dialogue window hides IE from tasklist" and got an answer but not an explanation.

Basically I had to set the Params.WndParentbut the question I have now is why? Why does this solve the problem (cause it does)?

Community
  • 1
  • 1
Asher
  • 1,016
  • 1
  • 6
  • 20

2 Answers2

2

The official documentation of which windows appear in the taskbar tells you the answer to this question:

The Shell creates a button on the taskbar whenever an application creates a window that isn't owned. To ensure that the window button is placed on the taskbar, create an unowned window with the WS_EX_APPWINDOW extended style. To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.

However, the rules stated there are a little opaque. Raymond Chen summarises the rules as follows:

There are some basic rules on which windows go into the taskbar. In short:

  • If the WS_EX_APPWINDOW extended style is set, then it will show (when visible).
  • If the window is a top-level unowned window, then it will show (when visible).
  • Otherwise it doesn't show.

Setting WndParent in CreateParams in the linked question means that the window is no longer a top-level windowbecomes an owned top-level window. Thanks for Sertac and Rob for correcting me.

Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • The particular one in the referred question rather becomes an "owned top-level" window. – Sertac Akyuz Mar 10 '11 at 13:33
  • @Sertac Is that right? If a window has a parent, then is the parent also the owner? – David Heffernan Mar 10 '11 at 13:45
  • The parent is never the owner because "[a window can have a parent or an owner but not both](http://blogs.msdn.com/b/oldnewthing/archive/2010/03/15/9978691.aspx)." And since they're mutually exclusive, the same parameter is used for both in `CreateWindowEx`, and the value that gets passed to that parameter is `CreateWindowEx` is kept in `Params.WndParent`. – Rob Kennedy Mar 10 '11 at 14:01
  • @David I've read the links but if my understanding is correct then those articles deal with the dialogue not being on the task bar. In the question IE is Still on the task bar but is not in the Tab task-List when the dialogue is displayed. Are you saying the setting filter through to IE? – Asher Mar 14 '11 at 06:10
0

Under a hood Delphi's VCL method ShowModal enumerates all visible thread windows and disables all of them (before showing your modal window pop-up). IE6 ActiveX container does nothing to prevent such manipulation with own windows. ActiveX controls very unsecure in IE6, they do what they want. So we get only some disabled IE windows and one active pop-up window on screen. But if the window is disabled, it can't be selected in the task list. Also your pop-up window has bsToolwindow property (or WS_EX_TOOLWINDOW originally in Windows API) which says that it should not be visible in task list (Alt-Tab switching, Explorer taskbar). As a result, we have no windows at all from IE that can be activated through Alt-Tab.

This only applies to windows that do not have a parent. For Delphi's ActiveX controls, forms don't have parent by default (except main Form). When you assign parent to your Form, and don't use ShowModal method (in answer Show method used) you are preventing this situation. In that case, IE windows don't change their original properties.

Community
  • 1
  • 1
Dima Zorin
  • 80
  • 2
  • 8