Click here to Skip to main content
13,593,048 members
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 9 Mar 2012
Licenced CPOL

Badges for Windows 7

, 9 Mar 2012
Rate this:
Please Sign up or sign in to vote.
Short description how to create a sexy badge for windows 7 taskbar


How to use ITaskbarList3 in C++ to add overlay icon into taskbar. 

Using the code

Before using ITaskbarList3, we must receive TaskbarButtonCreated message from system. First we must register this message.

s_uTBBC = RegisterWindowMessage(L"TaskbarButtonCreated");

In our message loop we can catch this message and call our function:

if( message == s_uTBBC ) {
    onTaskbarButtonCreated(wParam, lParam);

Create instance of ITaskbarList3 and set the overlay icon.

static LRESULT onTaskbarButtonCreated(WPARAM wParam, LPARAM lParam) {

    HRESULT result = CoCreateInstance(CLSID_TaskbarList, NULL, 
                        CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&m_pTaskBarlist));

    if (SUCCEEDED(result)) { 
        result = m_pTaskBarlist->HrInit(); 
        if (SUCCEEDED(result)) {

            HICON icon = createBadgeIcon(_T("78"));
            m_pTaskBarlist->SetOverlayIcon(m_hWnd, icon, _T("Status"));


    return 0;

I use GDI+ for creating badge icon. For create cool small ellipse I use circle (letter 'l') from Wingdings font :)

static HICON createBadgeIcon(const TCHAR *value) {

    Color bagdeColor = Color(233, 0, 0);
    Color textColor = Color(244, 244, 244);
    Bitmap *bitmap = new Bitmap(24, 24, PixelFormat32bppARGB);
    m_Graphics = Graphics::FromImage(bitmap);
    StringFormat format(StringFormatFlagsNoWrap);
    m_Graphics->DrawString(_T("l"), 1, 
                            new Font(_T("Wingdings"), 24), 
                            RectF(1, 2, 24, 24), 
                            new SolidBrush(bagdeColor));
    m_Graphics->DrawString(value, wcslen(value), 
                            new Font(_T("Calibri"), 8), 
                            RectF(1, 2, 24, 20), 
                            &format, new SolidBrush(textColor));
    HICON icon;
    // Cleanup
    delete bitmap;
    return icon;


Version 1.0.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180618.1 | Last Updated 9 Mar 2012
Article Copyright 2012 by Grigory Avdyushin
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid