Home All Groups Group Topic Archive Search About

Minimize to Tray Button

Author
3 Oct 2006 9:30 PM
zakhirn
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 tray button. I have a Form that pops
up when excel loads, and I will add a command button called Minimize
that I just want to minimize excel to the system tray.


Thanks for your help.

Author
4 Oct 2006 8:25 PM
Mattias Sjögren
>Anyone have code that creates a button that will Minimize Excel to the
>system tray.

There's no way to really minimize a window to the notification area
(aka system tray). The notification area contains only icons, they can
represent anything and are not necessarily associated with a specific
window. What applications do is

1) Add a notification icon with the NotifyIcon class.
2) Override the minimization of the window and hide it instead so no
animation to the taskbar appears and removes the taskbar button if
there is one.
3) Optionally, use the DrawAnimatedRects Win32 API to make it look
like the window really is getting minimized to the notification area


Mattias

--
Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.