After arrival from my long-term project journey I've noticed a hot discussion about taskbar-system tray behavior in CDialog-based application. In fact the situation in these application is similar to the frame-based appplications. The only difference is to put the initialization code of dynamic-showing/hiding-of-taskbar-button into the InitInstance() method instead of PreCreateWindow() as seen here:
// Create the main owner invisible window.
// dMainFrameOwner - CDialog object mapped to the resource dialog template...,
// could be any type of window; this, however, is a quick solution.
BOOL bOwnerCreated = dMainFrameOwner.Create(IDD_FRAMEOWNER);
if (bOwnerCreated) dMainFrameOwner.ShowWindow(SW_HIDE);
// set the dialog as a parent of CMainFrame window
CShowHideDlg dlg(bOwnerCreated ? &dMainFrameOwner : NULL);
m_pMainWnd = &dlg
... Another discussion is the system tray logic. Warren Young in the previous comment writes that it seems to be difficult to collect both taskbar and system tray logic meaningfully together using my design-pattern. Actually, it doesn't. In the project example below I achieved the same goal as Warren did and, moreover, I'm still able to dynamically show/hide the taskbar button from within the CDialog application.
The problem of the latest discussion is that it's a bit out of scope of this article. Problems described earlier concerns the system tray logic and not the taskbar behavior itself as written in my article. Warren writes:
"Instead of all that trickery with invisible "owner" windows and twiddling style bits, we just hide the main dialog when we get minimized."
But how does all this concern taskbar button logic being discussed here? If we are able to solve a particular problem bypassing the taskbar 'overhead' not necessary there, then it's OK. But this is not the case. The mentioned citation can, however, be confusing for those trying to implement the taskbar behavior in the sense mentioned here. Actually, this is not a trickery but the legal guidelines described in MSDN as well. The only trickery concerns dynamic showing/hiding of the taskbar button at application runtime. Another way (as I know) is only to use the appropriate COM interface.
To clarify all these problems I've prepared the project considering our discussion. It's available on:
I know this is an old discussion but in my own dialog based
application, I only want to hide the application button on
the task bar when the application is minimized and I don't
want the application invisible to the Alt-Tab window.
When I minimize the application I have no problems on
putting the icon into the system tray but I also want the
taskbar button to disappear and that is proving difficult.
I tried to get a pointer to the ITaskbarList and dynamically
add and remove the application from the list but I can't
even get the compiler to recognize the ITaskbarList
interface name. Am I missing a header file or am I just
going about it the wrong way?
probably can you help me with my problem.
I want to change Window Styles so that there are only
MINIMIZEBOX and MAXIMIZEBOX, without SYSTEMMENU and
Disabling WS_SYSMENU causes automatically desabling
of all Buttons (WS_MINIMIZEBOX, WS_MAXIMIZEBOX and Close Button too).
For a worst case SYSMENU can remain but how desable the
Is there a tricky approach that allows to solve my problem?
Hiding from taskbar is interesting ,but wouldn't be more beautiful if the program hides like NetBus or SoftIce?
In Win98 when you press Ctrl+Alt+Del or in WinNT with TaskManager you can see it?
Can you give me an answer about this?
One comment for somebody who will try to make app without showing it on taskbar based on the modal dialog
(Dialog based appliacation) creating some hidden Wnd as a mainWnd and then DoModal to show the DLG. It
doesn't shut down on NT if you shutting down system - it is hanging unless you close it manually. I guess
this is because if you have Modal dialog and it is not the main app NT expect you to first close the Modal
dialog. However on 95/98 it shuts down fine.
So if your app is based on a dialog and you want it invisible on the task bar and the app will be running
all the time until you close WinNT don't do DoModal for the dialog..you will get a lot of complains from