Task Tray Applet Framework | CodeGuru

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, […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 29, 1998
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

 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


CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.