Hethu's Techno Babble

Monday, August 29, 2005

Minimize to Tray (Notification Area) and show Balloon Notifications in C#

I have been searching the web for quite a while for a .NET class that can do the minimize to tray animation and show balloon notifications in the notification area.

It is quite easy to make an .NET application show a notification icon in the taskbar notification area with the built in NotifyIcon .NET control. But it is not possible to show a balloon notification message like the one you see when you plug in a USB device, or the one that reminds you of "Files waiting to be written to CD". Also, the built-in NotifyIcon control doesn't allow you to do the window minimize animation onto the notify icon area as it should. Why have Microsoft not exposed these Win32 functionality to the .NET 1.1 control?

(By the way, there is no such thing called the System Tray, it is officially called the Taskbar Notification Area, but most people still call it the Tray)

If you want to do a minimize to tray, your best bet is to set Form.ShowInTaskbar=false; and show the NotifyIcon. But this results in an ugly and a bad minimize animation. The window appears to minimize to the taskbar area and disappears into thin air, and then suddenly the icon appears in the notification area out of the blue. That isn't right.

There are several CodeProject articles giving ways to do this properly. But the best implementation I have found yet is by Matt Griffith in his .NET utilities class library. His NotifyIcon class can do the following:

  1. Show the notification area icon and tooltip
  2. Minimize to Tray with window animation
  3. Restore from Tray with window animation
  4. Show balloon notifications in the notification area (cool!) until a given timeout

The class library is very well documented. Unfortunately no code samples are given but it's quite easy to figure it out.

Tuesday, August 23, 2005

Dotted GMails

So it seems that GMail addresses can have arbitrary dots in the first part of the email address, and still all the mails sent to those addresses will land on your mailbox properly.

So for example, all mail sent to hethu.n@gmail.com or h.e.t.h.u.n@gmail.com or he..th..un@gmail.com or whatever the creative dot combination you can come up with is still yours and all the mails will come to the same account.

Now why would this be useful? Well, you might want to give a specific dotted email address freely to the spammers and catch the spam easily with a mail filter and trash them. So when you are registering for a new website next time with your GMail address, think of giving it a dotted email address.

But wait, don’t get too exited. Will this neat cool feature create more problems than it solves? Couldn't the spammers just create arbitrary dotted addresses and spam you even more? After all, now they have thousands of dotted email aliases instead of one to spam you on!