Windows 7 Taskbar: Thumbnail Toolbars

February 26, 2009


Let’s recap what we’ve seen so far.  We’ve started with the fundamentals of the Windows 7 taskbar APIs and the scenarios they address, reviewed the concept of application id, enriched the taskbar button with progress bars and overlay icons, and took a deep long look from all angles at the jump list, including recent/frequent categories, user tasks and custom destinations.  The next feature on our desk(top) today is thumbnail toolbars.

Thumbnail toolbars are another productivity feature that gives us the ability to do more without actually switching to another application’s window.  A thumbnail toolbar is essentially a mini remote-control that is displayed when you hover over the application’s taskbar button, right beneath the application’s thumbnail.  For example, here is the Windows Media Player thumbnail toolbar, featuring the “Play”, “Previous” and “Next” toolbar buttons.


A “remote control” of this sort might not be appropriate for any application, but it’s extremely handy to have.  Without interrupting your work in one application, you can easily control what another application does – no switching or tabbing need to get there.

How do you add thumbnail toolbars to your application?  As always, the managed wrappers come to the rescue.  The ThumbButtonManager class (in the Windows7.DesktopIntegration project) manages the application’s thumbnail toolbar, and allows up to 7 buttons to be added to it (this is a Windows limitation, not a limitation of the managed wrapper).  The ThumbButton class represents an individual button on the thumbnail toolbar, and exposes the Clicked event which the application can handle in response to a button click.  Other convenience properties include Enabled and Visible, which change the button’s state in real-time.  (Note that there is no way to completely remove a button after adding it.)

The following code (taken from the Windows7.DesktopIntegration.MainDemo project) demonstrates how to add a thumbnail toolbar to an application.  Note that like all other taskbar-related activities, this should be done only after receiving the “TaskbarButtonCreated” message.

_thumbButtonManager = this.CreateThumbButtonManager();

ThumbButton button2 = _thumbButtonManager.CreateThumbButton(102, SystemIcons.Exclamation, "Beware of me!");

button2.Clicked += delegate


    statusLabel.Text = "Second button clicked";

    button2.Enabled = false;


ThumbButton button = _thumbButtonManager.CreateThumbButton(101, SystemIcons.Information, "Click me");

button.Clicked += delegate


    statusLabel.Text = "First button clicked";

    button2.Enabled = true;


_thumbButtonManager.AddThumbButtons(button, button2);

Note that you have tooltips and icons at your disposal to personalize the thumbnail toolbar to your application’s needs.  All you need to do now is override your windows’ window procedure and call the DispatchMessage method of the ThumbButtonManager, so that it can correctly route the event to your registered event handlers (and of course, don’t forget to call the default window procedure when you’re done!):

if (_thumbButtonManager != null)

    _thumbButtonManager.DispatchMessage(ref m);


base.WndProc(ref m);

While we’re at it, let’s make note of the not-so-obvious distinction between user tasks and thumbnail toolbar buttons.  A user task within a jump list does not have context – it is always present, regardless of whether the application is currently running or whether it is engaged in some sort of activity.  On the other hand, the thumbnail toolbar is present only when the application is running, and its buttons might be disabled or even hidden – based on the current context of the application.  (E.g. it would make little sense to enable the “Next” button in a media player if there is no current playlist.)

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



  1. SebastianMarch 2, 2009 ב 8:55 PM

    Hi, just wanted to drop a quick suggestion. This is unrelated to this blog post (sorry) but it’s something that really bugs me about the task bar so I want to make sure someone actually considers it.

    Here it goes: Clicking a task bar item should always, and immediately, open the application for that task bar item (either all its windows, or the most recently used window).
    “Click” means “NOW!”. Holding the button, or hovering would still bring up the little row of previews, but when the user clicks he’s letting you know that he doesn’t care about fine-tuning his selection, he just wants the app up front NOW.
    Having to click, then scan through thumbnails, then click again in order to switch to an app is ridiculously annoying, and is single-handedly responsible for me turning off the new task bar (even though I love it in every other respect!).

    If I want to switch back and forth between my mail app and e.g. Internet Explorer (to, say, copy an URL), I don’t want to have to hunt around the list of tabs that comes up every time – just show me IE and whatever tab was open last will be there for me.

    This is causes a severe case of “get out of my way and let me get stuff done” frustration.

  2. SebastianMarch 2, 2009 ב 8:59 PM

    Actually just letting me double-click an item to bring it up immediatly (again, either all of the windows grouped under it, or just the most recently used one) would be enough for me (though I still think that “click” means “now”). That way you’re not changing the behaviour, but just giving me the option to bypass the tedious extra step when I don’t need it.

  3. Sasha GoldshteinMarch 6, 2009 ב 11:16 PM

    These are great suggestions, but I don’t work for the Windows team – I’m not even a Microsoft employee. You might want to take a look at the Engineering Windows 7 blog, where these suggestions are taken very seriously.

    Note that in RC there are some changes around the taskbar which might make your experience better.

  4. bpMarch 17, 2009 ב 4:13 PM

    For the total newbies, how do you include the Windows7.DesktopIntegration stuff into a project??

  5. Sasha GoldshteinMarch 25, 2009 ב 2:18 PM

    Well, it’s a managed class library, so you use Add Reference (in Visual Studio) and you’re good to go.
    Or did I get your question wrong?

  6. Pavel AzanovApril 4, 2009 ב 4:03 PM

    I’m trying to add 9 ThumbButtons to my application and show (if the user is logged in 6, if not 3) ThumbButtons. The problem is – i can’t add 9 buttons, because i get an ArgumentException on the ThumbBarAddButtons method of the ITaskbarList3 interface. The solution would be: just to remove the buttons i want to make invisible. But there is no method to remove ThumbButtons! Any ideas?

  7. Sasha GoldshteinApril 5, 2009 ב 9:04 PM

    IIRC there is a hard limitation of at most 7 buttons on the thumbnail toolbar. Additionally, there is no way to remove buttons.

  8. Pavel AzanovApril 6, 2009 ב 3:35 PM

    Thanks for the information 🙂 I added 6 buttons and now i’m just changing the icons and the eventhandlers. But i think a function to remove buttons would be very useful^^

  9. Sasha GoldshteinApril 13, 2009 ב 7:06 PM

    @Pavel: I think so too, but it’s not a limitation of the wrapper – it’s the limitation of the underlying ITaskbarList3 COM interface which provides the thumbnail toolbar feature.

  10. Talking ClipboardMay 30, 2009 ב 11:46 AM

    When I make a button visible and the other one invisible, the thumbnail tool buttons does not refresh automatically, nor any refresh API provided. This causes the toolbar thumbnail to look weird

  11. Davin StuderSeptember 21, 2011 ב 11:38 PM

    How do you change the visible state of the ThumbButton while the window thumbnail is visible? When I do this my buttons go all wonky until the thumbnail disappears and is re-hovered over. Basically, what I have is a play button and a pause button and when you click the play or pause button it sets its visibility to false and sets the other’s visibility to true. But if you do this while the thumbnail is visible all but two of the ThumbButtons disappear and the remaining two get extra wide. However, if I re-hover over the program icon and the thumbnails shows up the ThumbButtons are all back to the way they should be.