Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create rich tooltips and rich balloons in notification area

I've been wondering, whenever you call the ShowBalloonTip method of the NotifyIcon class, you get a balloon tooltip like this:

Standard Baloon Tip
Fig1: Standard Balloon Tooltip



Some applications and Microsoft products are able to display more than those 'simple' balloon tips.
Here are some samples:

Windows Update TipFig2: Windows Update Balloon Tooltip


Driver Installation Tip
(source: microsoft.com)

Fig3: Hardware Driver Installation Balloon Tooltip


USB Safely Remove
Fig4: Hardware Removal Tooltip (Program: USB Safely Remove)



A good look at Figures 2, 3, and 4 reveals they aren't standard balloon tooltips!

Fig2 has a different shape, possibly from setting the Region property. It also has a custom icon which is much bigger than the standard ToolTipIcon.

Fig3 uses the standard shape (I think) but it has a custom icon which needless to say is larger than the default ToolTipIcon size.

Fig4 uses a standard ToolTipIcon but it has a different shape.


My question is how does one create any of the 'rich' balloon tooltips that are seen in the notification area in .NET? I can handle WinAPI as well as it can produce the necessary output.

like image 240
Alex Essilfie Avatar asked Jan 12 '12 14:01

Alex Essilfie


1 Answers

You have to use the Win32 Function Shell_NotifyIcon. You can set the dwInfoFlags member of the NOTIFYICONDATA structure to NIIF_USER in order to use a custom icon for the balloon tooltip.

On Windows XP Service Pack 2 and later you can use the hIcon member to specify a custom icon.

On Windows Vista and later the NOTIFYICONDATA structure contains the addiional member hBalloonIcon. You can use this member to specify a custom icon if you have set the cbSize member to the correct size of the extended NOTIFYICONDATA structure.

like image 59
Norbert Willhelm Avatar answered Oct 20 '22 01:10

Norbert Willhelm