Scott Hanselman

Vote on this Whidbey Bug: How to create a Tray Icon (NotifyIcon) with WinForms 2.0

January 16, '05 Comments [9] Posted in Programming
Sponsored By

Whatisplaying1

While Tray Icons (and applications that use ONLY TrayIcons as their UI) are a major part of our lives, there's limited support in WinForms (2.0) for them without resorting to P/Invoke and vestigial MainForms who only call this.Hide().

NotifyIcon should be extended to support BalloonHelp. Hans Blomme's now-famous extended version of NotifyIcon is the canonical example. It still works under 2.0, but the 2.0 addition of the ContextMenuStrip makes it a little tricky. His free stuff could be integrated into the 2.0 NotifyIcon easily, adding a powerful (and missing) feature to 2.0 WinForms. Additionally, there should be a way for a Form to startup hidden to avoid the flash of the form before it calls this.Hide(), deferring to it's NotifyIcon.

Help us all out and vote to get this omission fixed in Whidbey.

UPDATE: Some Reflectoring has confirmed that has in fact been fixed in the December CTP! All is as it should be. Thanks to Chris Sells and Scott Swigart.

Now playing: Kanye West, Twista & Jamie Foxx - Slow Jamz

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. I am a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Sunday, January 16, 2005 6:24:17 AM UTC
OK, done. I noticed the following, though, on your bug report:

OS Language: Dutch

??
Sunday, January 16, 2005 7:48:35 PM UTC
> While Tray Icons (and applications that use ONLY TrayIcons as their UI) are a major part of our lives

I've told you a million times to stop exaggerating.
Sunday, January 16, 2005 11:12:30 PM UTC
So how is Raymond Chen's campaign to educate the world about the fact that THEY'RE NOT CALLED TRAY ICONS going, do you think?

:-)
Monday, January 17, 2005 9:18:30 AM UTC
Maybe its just too late and I'm not thinking/reading clearly (in which case I may be completely off here), but just FYI, you don't actually have to have a form run on startup in a WinForms app.
Monday, January 17, 2005 4:13:09 PM UTC
Interesting point, but what would start the message pump, then?
Monday, January 17, 2005 10:42:31 PM UTC
I'm been having some internal conversations w/ the Windows Forms team that indicate that this feature was added to Windows Forms in either the November or December CTP of Whidbey. Apparently, there's a ShowBalloonTip method on the NotifyIcon class. Can anyone confirm?
Tuesday, January 18, 2005 1:18:09 AM UTC
I wish I could remember the right blog (I would then point you to it) but I read recently that the pump will get started anyway, you don't need to open a form. I'm positive this came from a Microsoftie...
Tuesday, January 18, 2005 2:55:29 AM UTC
Here, I dug it up, courtesy of IanG: http://www.interact-sw.co.uk/iangblog/2004/11/30/nomainform.
Wednesday, January 19, 2005 7:37:27 AM UTC
My correct email below...
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.