"Maka Sili" <ma******@hotmail.com> wrote in message
news:et**************@TK2MSFTNGP15.phx.gbl...
I already have the function/menu in the system tray (no problem there).
The problem is in the taskbar entry (not icon): taskbar entry meaning one
of those list of running/active applications that you can "Alt-Tab" to.
Problem is "when the application is in the foreground and in normal view,
clicking on that "active application's entry in the taskbar" does not
minimize
the application. Supposedly, it should, just like if you minimize this
news readers window by clicking on the taskbar on the entry with caption
"Re: Force Minimize to..." or something like that.
The shell sends a WM_SYSCOMMAND with the SC_MINIMIZE flag when you choose
that menu option, no? But it _does_ not know that you'd prefer to minimize
to a tray icon so you have to add a handler for that message, and in it
potentially hide your "main" window and insert the tray icon if it is not
already there.
Just by the way, some tray applications forego the "button" in the taskbar
altogether. If you don't want to do that you can stop reading here.
Otherwise note to do that there are a few options:
1) Hide your main (unowned) window and display your UI in
another window which is a child of the hidden main window
2) Give the (visible) main window the WS_EX_TOOLWINDOW style.
A side effect here is a more squat caption.
3) Use the shell's ITaskBarList interface
Regards,
Will