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

The new task bar are visu­ally much more pleas­ant and func­tion­ally it has also intro­duced a num­ber of rather use­ful new fea­tures such as the ‘jump list’ and the abil­ity to dis­play the progress bar on the task bar icon itself! In addi­tion, mul­ti­ple run­ning instances of the same appli­ca­tion is grouped together and when you hover over the icon you get a pre­view of each instance (see below).

image

The task bar works out which win­dows to group together by using the Appli­ca­tion 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 sys­tem. How­ever, an appli­ca­tion that owns mul­ti­ple processes or an appli­ca­tion that is run­ning in a host process might need to explic­itly iden­tify itself so that it can group its oth­er­wise dis­parate win­dows under a sin­gle taskbar but­ton and con­trol the con­tents of that application’s jump list.

Sup­port for the new task bar fea­tures is not included in the core .Net frame­work, you need to down­load the lat­est Win­dows API Code Pack (see Ref­er­ences sec­tion), build the solu­tion and ref­er­ence 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 win­dow, how­ever, it pays to write safe code that won’t break out­side Win­dows 7 so your code will usu­ally 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";
}

Ref­er­ences:

Win­dows­API Code Pack

Windows7 Train­ing Kit for Developers

Share

Leave a Reply