Task Tray Applet Framework

 Download Source Code and Example

To put an icon in the task tray all an application has to do is call Shell_NotifyIcon() to supply the icon, tool tip, callback message and a window to send it to. Making an application that's just a task tray applet is just a case of creating a hidden window, calling Shell_NotifyIcon() and processing the messages. The messages are your standard mouse click type messages. It's not that difficult but it takes a bit of time.

Creating a hidden window with a WndProc that responds to Task Tray applet messages correctly and does all the right things can be cumbersome if all you want to do is pop up a dialog box app from the task tray. The framework lets you derive from an base class that handles all of that stuff for you. All you need to do is override a few virtual functions and you have a dialog popping up! CJBTaskTrayApplet also gives you multiple applets in one exe (with multiple separate icons in the task tray) and automatic right button menu handling.

To implement your task tray applet you need to do the following:

  • include "TaskBarApplet.hpp" and "TaskBarAppletMain.hpp" the later gives you a WinMain() implementation.
  • publicly derive a class from CJBTaskTrayApplet.
  • implement the pure virtual functions GetTrayTip() and GetIcon() to supply the basic require by the framework.
  • handle OnLeftDoubleClick() to do something when a user double clicks on you. This is where you would generally show a dialog or something.
  • create an instance of your applet at global scope.
  • link with TaskBarApplet.cpp.

So that this article and code can be kept up to date more easily I've provided a link to where the article is located on my own web pages. Read the full article and download the source code.

Last updated: 3 July 1998




Comments

  • don't bother looking for the code....

    Posted by yuban on 11/14/2007 06:48pm

    This is a dead link ( at least a link to a page with dead links ): Read the full article and download the source code.

    Reply
  • Does not seem to support ActiveX control

    Posted by Legacy on 02/04/2003 12:00am

    Originally posted by: Bobby

    Worked great until I added an ActiveX control to the dialog based application. Any suggestions?

    Reply
  • displaying text in systray

    Posted by Legacy on 10/17/2001 12:00am

    Originally posted by: C Zeeshan

    Is there any way I can display text instead of icon image in the system tray?

    Reply
  • Can this be used in a dll?

    Posted by Legacy on 09/05/2001 12:00am

    Originally posted by: Anthony Fryer

    I want to write a dll that will potentially be linked by several different programs, that may or may not have their own main window. When the dll loads, I want to display an icon in the task tray, regardless of the program that loads it. Since the dll won't know in advance about the main window, do you know if this is possible? I'm wondering if their will be issues to do with sending messages to a window.

    Thanks,

    Anthony

    Reply
  • Call a program at Task Tray

    Posted by Legacy on 06/30/2001 12:00am

    Originally posted by: Yueh F.

       Is there any way to call a program at Task Tray in my program rather than use mouse click?
    

    Reply
  • Some tweaks needed

    Posted by Legacy on 03/17/2000 12:00am

    Originally posted by: Chaim Nussbaum

    A problem occurs when the user floats the mouse over the icon, it causes the the front-most window to lose focus, this is not consistent with other tray icons.

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: October 23, 2014 @ 12:00 p.m. ET / 9:00 a.m. PT Despite the current "virtualize everything" mentality, there are advantages to utilizing physical hardware for certain tasks. This is especially true for backups. In many cases, it is clearly in an organization's best interest to make use of physical, purpose-built backup appliances rather than relying on virtual backup software (VBA - Virtual Backup Appliances). Join us for this eSeminar to learn why physical appliances are preferable to …

  • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds