By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

Force Minimize to taskbar

P: n/a
Hi,

My VC++ application does not have a titlebar (and therefore no System menu,
no minimize, no maximize
and no close button). We have a custom button for minimize and close.

When the app is in normal/maximized view, clickinng on the taskbar entry
does not minimize the
application. Normally (with apps with titlebar), the application would
minimize when you click on
the taskbar entry.

How do I trap the click event on the taskbar entry so I can minimize the
application?

Thanks for any help.

Nov 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Maka Sili" <ma******@hotmail.com> wrote in message
news:OM**************@TK2MSFTNGP12.phx.gbl...
My VC++ application does not have a titlebar (and therefore no System
menu,
no minimize, no maximize and no close button). We have a custom button
for minimize and close.
...
How do I trap the click event on the taskbar entry so I can minimize the
application?


The shell provides a single function for adding, modifying and updating the
icons in the tray. It is documented here:

http://msdn.microsoft.com/library/de...notifyicon.asp

VC++ v6.0 comes with (or is it the SDK that comes with?) a sample named
TRAYNOT, which demonstrates this "tray notification icon" stuff.

http://msdn.microsoft.com/library/de...smptraynot.asp

Note two important things: Before you put up a context menu in response to a
click on such an icon of yours make sure that a window of yours is in the
foreground - i.e. call SetForegroundWindow(). In addition make sure you send
that Window a WM_NULL message when you take the menu down.

Regards,
Will
Nov 17 '05 #2

P: n/a
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.

"William DePalo [MVP VC++]" <wi***********@mvps.org> wrote in message
news:ue**************@TK2MSFTNGP15.phx.gbl...
"Maka Sili" <ma******@hotmail.com> wrote in message
news:OM**************@TK2MSFTNGP12.phx.gbl...
My VC++ application does not have a titlebar (and therefore no System
menu,
no minimize, no maximize and no close button). We have a custom button
for minimize and close.
...
How do I trap the click event on the taskbar entry so I can minimize the
application?


The shell provides a single function for adding, modifying and updating
the icons in the tray. It is documented here:

http://msdn.microsoft.com/library/de...notifyicon.asp

VC++ v6.0 comes with (or is it the SDK that comes with?) a sample named
TRAYNOT, which demonstrates this "tray notification icon" stuff.

http://msdn.microsoft.com/library/de...smptraynot.asp

Note two important things: Before you put up a context menu in response to
a click on such an icon of yours make sure that a window of yours is in
the foreground - i.e. call SetForegroundWindow(). In addition make sure
you send that Window a WM_NULL message when you take the menu down.

Regards,
Will

Nov 17 '05 #3

P: n/a
"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
Nov 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.