Windows 7 Taskbar – Application ID

By now, Windows 7 is almost old news and most of you would have been using or at least seen Windows 7 and one of the first things that should have caught your attention is the redesigned task bar.

The new task bar are visually much more pleasant and functionally it has also introduced a number of rather useful new features such as the ‘jump list’ and the ability to display the progress bar on the task bar icon itself! In addition, multiple running instances of the same application is grouped together and when you hover over the icon you get a preview of each instance (see below).

image

The task bar works out which windows to group together by using the Application User Model IDs (referred to as AppIDs from here on). In most cases you can rely on the AppID assigned to a process by the system. However, an application that owns multiple processes or an application that is running in a host process might need to explicitly identify itself so that it can group its otherwise disparate windows under a single taskbar button and control the contents of that application’s jump list.

Support for the new task bar features is not included in the core .Net framework, you need to download the latest Windows API Code Pack (see References section), build the solution and reference these two dlls in your project:

Microsoft.WindowsAPICodePack.dll

Microsoft.WindowsAPICodePack.Shell.dll

It takes only one line of code to set the AppID of a new window, however, it pays to write safe code that won’t break outside Windows 7 so your code will usually look more like this:

// Check whether the taskbar feature is supported (Win 7 or Win Server 2008 R2)
if (TaskbarManager.IsPlatformSupported)
{
    // Set the AppID for the current process TaskbarManager.Instance represents an 
    // instance of the Windows Taskbar
    TaskbarManager.Instance.ApplicationId = "NewApplicationID";
}

References:

WindowsAPI Code Pack

Windows7 Training Kit for Developers

Leave a Comment

Your email address will not be published. Required fields are marked *