I have got an internal helper app without user interface which is started from another program which interacts with the user. I do not want a taskbar entry for the helper app. But anyway, a Window exists. I need an API call which removes the taskbar entry of the window. I know the Window Handle and the Process ID of the helper app. I have seen that there are calls in specific libraries, but I need the base API calls.
-
I have got some additional hints, but not the solution. You can browse through the windows by `GetWindow (hwnd, GW_HWNDNEXT)` and if you have got a process ID, you can query the window handle by GetWindowThreadProcessID. Perhaps we can set a window property. In the very similar OS/2 API, there is a "switch list" with several API calls, but Windows does not know this direct access. In OS/2, you can also set Session properties via Session ID (not window handle) for hiding all windows of the session in the tasklist. But I did not find any Windows API calls for doing this. – Martin V Jul 17 '20 at 06:32
2 Answers
Here are the factors that affect whether a window has a corresponding task bar entry:
Whether it has a parent. A window with a parent is a child window (and thus should also have
WS_CHILD
). A window without a parent is a "top-level" window. Top-level windows generally do get a task bar entry.Whether it has an owner. The documentation can sometimes be ambiguous by often blurring the distinction between an owner and a parent. But it's possible for a non-child window to have an owner. Dialog boxes and tool panels are typical examples of top-level windows that are owned. Owned windows generally do not have a task bar entry.
Whether is has any of these extended window styles:
WS_EX_APPWINDOW
forces a task bar entry even if the window is owned.WS_EX_NOACTIVATE
prevents the window from having a task bar entry, but has other effects as well. It's for a specific, unusual type of application window and should not be used just to prevent a task bar entry.WS_EX_TOOLWINDOW
prevents a top-level window from having a task bar entry. Note that it also affects the style of the non-client area.
When you don't want the other side effects form WS_EX_NOACTIVATE
or WS_EX_TOOLWINDOW
, the best way to prevent the window from being listed in the task bar is to have it owned by another top-level window.
If you have a window that should be listed in the task bar but isn't (e.g., because it has an owner), then apply WS_EX_APPWINDOW
.
You set extended window styles when you create a window. You can update the styles for an already-existing window by using SetWindowLongPtr with GWL_EXSTYLE
. You might need to use SetWindowPos (possibly with SWP_FRAMECHANGED
) after changing styles for the window to update to reflect the new style.

- 45,555
- 16
- 123
- 175