7

in a C# application that has no graphics at all, and does a bunch of network operations, I need to be able to show notification bubbles (on top of everything, for a few seconds) near the icon tray on certain events.

I've been looking at this : http://www.codeproject.com/KB/miscctrl/taskbarnotifier.aspx

But with no success. The problem with it is that the windows designed there won't show on asynchroneous events. It seems that I need a main form first on which I add delegates for it to work, which I have no need for.

All options I've seen so far require me to have a form in my application, but that won't happen. Is it impossible then to have these bubbles ? Any ideas ? There must be a way to add an icon in the tray popping messages inconditionally and without GUI right ?

BuZz
  • 16,318
  • 31
  • 86
  • 141

2 Answers2

8

Taken from Systray icon for Console application and Creating balloon tooltip in C#

Add a reference to both System.Windows.Forms and System.Drawing.

Update:

using System.Windows.Forms;
using System.Drawing;
...

private void Form1_Load(object sender, EventArgs e)
{
    var item = new NotifyIcon(this.components);
    item.Visible = true;
    item.Icon = System.Drawing.SystemIcons.Information;
    item.ShowBalloonTip(3000, "Balloon title", "Balloon text", ToolTipIcon.Info);
}

Also it can be that popups are disabled in registry.

Community
  • 1
  • 1
Vitaliy
  • 2,744
  • 1
  • 24
  • 39
  • This example also does not work for me. The trick is to set the tray icon: `icon.Icon = SystemIcons.Information;`. – illagrenan Feb 18 '14 at 19:22
  • 1
    I've updated the example and verified on my side - thank you for pointing into correct solution – Vitaliy Feb 19 '14 at 15:39
2

Look at the NotifyIcon class, it allows you to put icons into the notification area as well as doing balloon notifications which is what you're after.

George Duckett
  • 31,770
  • 9
  • 95
  • 162
Kevin Holditch
  • 5,165
  • 3
  • 19
  • 35