Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1863
  • Last Modified:

Balloon (System Tray) Events

Hi,

I'd like to send certain events from my app to appear as bubble/balloon tips from the system tray.  I've seen a lot of documentation on this, including a really straightforward example from MS, but although the project compiles the balloons dont appear.  Could anyone give me a really simple example of a balloon notification, on minimize, or on.. any event?
Thanks.

- M

0
nikez2k4
Asked:
nikez2k4
  • 2
  • 2
2 Solutions
 
Mikal613Commented:
heres one in vb.net
0
 
Mikal613Commented:
0
 
dbtothCommented:
This is probably exactly what you are looking for...

http://www.codeproject.com/cs/miscctrl/taskbarnotifier.asp

I use this myself, it works great!

All you will need to do is wire the desired events. In my case, I want my window to vanish when minimized and run using the notifier above. To enable that kind of functionality, drag and configure a NotifyIcon into your project, this will be the icon displayed in the systray that represents your application. To make your application vanish when minimized (so that only the notify icon shows) wire this event

private void Form1_Resize(object sender, System.EventArgs e)
{
      if (this.WindowState == FormWindowState.Minimized)
      {
            // Resized because of a minimize
            this.Hide();
      }
}

I tried directly wiring the minimize event and it didn't work as well as connecting into the resize event above.

You can also create a context menu to appear when your icon is right-clicked, which is handy if you want to redisplay your form. Simply create a normal menu in your application, then in the properties of the NotifyIcon, put the menu name in the ContextMenu field. I created a "Show Main Window" menu entry, the click event for which is:

private void cxMenu_ShowMain_Click(object sender, System.EventArgs e)
{
      if (this.WindowState == FormWindowState.Normal)
      {
            // Already in normal state, bring to front
            this.Activate();
      }
      else
      {
            this.Show();
            this.WindowState = FormWindowState.Normal;
      }
}

This will either restore the main window to the "front" application if it's already open, or un-minimize it if necessary. The Show() is required if you hid the window on minimize.
0
 
nikez2k4Author Commented:
Thanks for the links/comments.  I'm checking them out later today.
dbtoth -- that code you pasted, is this code just to minimise the app to the system tray and hide from the taskbar? I cant see anything in there for Balloon (system tray) tips...

- M
0
 
dbtothCommented:
The link at the top of the comment is to a full featured MSN'like pop up... I will whip you up some basic balloon code and post it today.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now