473,327 Members | 1,967 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Force Minimize to taskbar

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
3 4929
"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
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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: kurotsuke | last post by:
How can I hide a Form (instead of having it reduced to the taskbar) when the minimize button is pressed in C# (there's an icon in the tray bar)? I added the code protected override void...
0
by: Víctor | last post by:
It's possible minimize windows taskbar? I can hide it, but I haven't found a way to minimize or move. I tried by using API SetWindowPos, but do nothing, and when I maximize application windows,...
2
by: Nikki | last post by:
Hi, I m working on a windows application using c#.NET. Using borderless non-rectangular forms. Can anybody tell me how to minimize / restore that application from taskbar. (I m already using...
4
by: steve | last post by:
hi all, i was wondering how is it possible to add an extra box ( i think they are called boxes: upper right corner ...) in a form that will minimize it in the system tray? You know some...
1
by: zakhirn | last post by:
Anyone have code that creates a button that will Minimize Excel to the system tray. I do not need anything complicated like changing the minimize button or the close button to a minimize to...
3
by: philelpko | last post by:
Morning all, 2 questions...... I have disabled the control boxes, minimize/maximize, resize etc on my forms so users cannot do anything other than what the forms allow. The problem is that...
4
by: Hutch | last post by:
I also un-checked all of the check boxes in the database's Startup options menu. I then added a button to the form so that the user can close the database, and another button so that the form can...
3
by: Jimmy | last post by:
I'm kinda newbie to python and wxPython. Now I'm confronting a thorny problem: how can I make my program minimize to the taskbar represented as an ico, and when there is some message from network...
2
by: devendraagashe | last post by:
I am developing java awt frame application. When i click on the minimize button, the icon is displayed in taskbar. but i want it not to display on taskbar, but it should go to system tray from...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.