Click here to Skip to main content
13,352,157 members (74,393 online)
Click here to Skip to main content
Add your own
alternative version


325 bookmarked
Posted 11 Jul 2002

Taskbar Notification dialog

, 11 Jul 2002
Rate this:
Please Sign up or sign in to vote.
A MSN IM-style popup notification dialog
<!-- Download Links -->


A few weeks ago I saw a MSN messenger popup class on Codeproject written by Prateek Kaul. Since I needed a taskbar popup with skin support, I decided to write my own new class.

This is my first submission to Codeproject, since I think my code begins to be mature enough to be posted.


This class needs MFC to be either statically or dynamically linked in your project; it has been written, compiled and tested under Visual Studio .Net (but should work with VC6)

How to use the Class

The class is very easy to use: Just add TaskbarNotifier.h and TaskbarNotifier.cpp into your project, then include TaskbarNotifier.h into your application, add a CTaskbarNotifier member variable in the header file of your Dialog or Window class.

In the OnInitDialog or OnCreate member functions add the following lines:


Then when you want to show the popup animation just call anywhere m_wndTaskNotifier.Show("Text to display"); this will show the animation of the window appearing and then disappearing. You can call again the Show() method whenever you want. If the popup was still here, the text is just replaced, if it was disappearing, it maximizes again.

Be sure not to allocate the CTaskbarNotifier each time you want to show a message, because the skinning function takes a little CPU time to generate the region used to make a non rectangular window.

Class Documentation

int Create(CWnd *pWndParent);

Creates the popup window which remains hidden until Show() is called


BOOL SetSkin(UINT nBitmapID,short red=-1,short green=-1,short blue=-1);
BOOL SetSkin(LPCTSTR szFileName,short red=-1,short green=-1,short blue=-1);

Those two functions assign a skin to the popup, they take as parameter either a Bitmap resource ID or the path of a bitmap file.
The optional parameters are the RGB values for the transparency color for the bitmap. Use these parameters only if you want a non rectangular window; if these parameters are left blank no Region is created.


void SetTextFont(LPCTSTR szFont,int nSize,int nNormalStyle,int nSelectedStyle);

This function permits to specify the Font used for displaying the text (two styles are possible, one for the normal state and one when the mouse is over the window)

nNormalStyle or nSelectedStyle can be one or a combination of these parameters



void SetTextColor(COLORREF crNormalTextColor,COLORREF crSelectedTextColor);

This function sets the color of the text when in normal or selected state.


void SetTextRect(RECT rcText);

This function allows to define a rectangle within the bitmap which will be the clipping zone for displaying the text.


void Show(LPCTSTR szCaption,DWORD dwTimeToShow=800,DWORD dwTimeToStay=3000,
           DWORD dwTimeToHide=500,int nIncrement=1);

Dispays the popup window animation:

szCaption: Text to display
dwTimeToShow: Duration in milliseconds for the popup to be fully visible
dwTimeToStay: Duration in milliseconds for the popup to be stay visible
dwTimeToHide: Time in millisecond for the popup to completely disappear
nIncrement: Pixel increment for moving the window during the animation (the higher, the faster)

Show can be called even if the popup is already visible, being hiding or showing.

void Hide();

Manually Hides the popup.

Additional notes:

When the user clicks on the popup, a message is being sent to its parent window (WM_TASKBARNOTIFIERCLICKED defined in TaskbarNotifier.h), you can intercept it by adding in your Message Map macro:


The fact I'm not releasing the HRGN handle is because when you call SetWindowRgn() function, the GDI takes care of the object deletion.


Thanks to Prateek Kaul whose code inspired me to write this class and to Vander Nunes for his article about skinning a window.

I hope this class will be useful to you, if you find any memory or GDI leaks, please let me know. If you have suggestions to enhance this class functionalities, please post a comment.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

John O'Byrne
Web Developer
United States United States
I live in Santa Clara CA and work as a software engineer for SAP Business Objects.

My areas of expertise are user interface developments in Eclipse RCP / SWT / Draw 2D and C#

You may also be interested in...

Comments and Discussions

AnswerRe: WTL Version? Pin
WTL Student6-Jun-05 14:44
memberWTL Student6-Jun-05 14:44 
GeneralRe: WTL Version? Pin
Dean Hallman6-Jun-05 18:34
memberDean Hallman6-Jun-05 18:34 
GeneralHelp Pin
Ahmad Hussain19-Mar-05 19:49
memberAhmad Hussain19-Mar-05 19:49 
QuestionCan you convert this to a component? Pin
odegnan18-Mar-05 6:51
memberodegnan18-Mar-05 6:51 
AnswerRe: Can you convert this to a component? Pin
John O'Byrne18-Mar-05 8:33
memberJohn O'Byrne18-Mar-05 8:33 
GeneralRe: Can you convert this to a component? Pin
odegnan19-Mar-05 8:27
memberodegnan19-Mar-05 8:27 
GeneralPopup parent (fixed) Pin
Max Santos31-Dec-04 6:06
memberMax Santos31-Dec-04 6:06 
GeneralRe: Popup parent (fixed) Pin
cnss22-Feb-05 10:21
membercnss22-Feb-05 10:21 
very good! I need your code, please send it to, thanks!
GeneralRe: Popup parent (fixed) Pin
Max Santos14-Mar-05 14:00
memberMax Santos14-Mar-05 14:00 
GeneralRe: Popup parent (fixed) Pin
alfonsopilato21-Nov-06 17:16
memberalfonsopilato21-Nov-06 17:16 
GeneralRe: Popup parent (fixed) Pin
Max Santos14-Mar-05 13:59
memberMax Santos14-Mar-05 13:59 
GeneralRe: Popup parent (fixed) Pin
boytony25-Sep-05 17:06
memberboytony25-Sep-05 17:06 
GeneralRe: Popup parent (fixed) Pin
Aji Varghese Tera12-May-06 11:48
memberAji Varghese Tera12-May-06 11:48 
Generalm_nIncrement Pin
Max Santos18-Dec-04 9:15
memberMax Santos18-Dec-04 9:15 
GeneralTaskbarnotifier without a dialog Pin
PeteMoody25-Nov-04 3:53
memberPeteMoody25-Nov-04 3:53 
Generalalert window hangs Pin
coolcoolyogs5-Nov-04 14:06
membercoolcoolyogs5-Nov-04 14:06 
GeneralRe: alert window hangs Pin
Rahul A Jadhav22-Sep-05 4:20
memberRahul A Jadhav22-Sep-05 4:20 
Generalbelow i wanted to say &quot;TopMost&quot;, not &quot;focus&quot;, sorry again. Pin
dido2k27-Oct-04 12:36
memberdido2k27-Oct-04 12:36 
GeneralFix: losing focus problem Pin
dido2k27-Oct-04 12:19
sussdido2k27-Oct-04 12:19 
GeneralRe: Fix: losing focus problem Pin
alfonsopilato21-Nov-06 17:13
memberalfonsopilato21-Nov-06 17:13 
GeneralRe: Fix: losing focus problem Pin
Member 7211863-Feb-10 10:23
memberMember 7211863-Feb-10 10:23 
QuestionNice article, Can you go horizontal? Pin
Soliant20-Jun-04 17:09
memberSoliant20-Jun-04 17:09 
GeneralDoesn't work when inside a thread Pin
JDBP27-May-04 6:26
memberJDBP27-May-04 6:26 
GeneralRe: Doesn't work when inside a thread Pin
Max Santos18-Dec-04 9:22
memberMax Santos18-Dec-04 9:22 
GeneralRe: Doesn't work when inside a thread Pin
Faladida11-Sep-05 16:45
memberFaladida11-Sep-05 16:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.180111.1 | Last Updated 12 Jul 2002
Article Copyright 2002 by John O'Byrne
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid