by November 7, 2009 0 comments

We continue our series of Win 7 development by looking at one of the most
useful features of Windows 7 — Jump Lists.Jump Lists can be thought of as a mini
start menu for each application. Jump Lists can consist of Tasks and
Destinations organized by Categories. Tasks are stuff that the application can
‘do’ — such as play the next track, open another application or create a new
email. Destinations are stuff that the application can ‘open’ — such as files,
folders, emails, etc. Categories allow you to organize these tasks and
destinations logically into groups. There are some categories that are
pre-defined such as ‘Recent’, ‘Frequent’ and ‘Pinned’. More about these a little

To add the Jump List features into your application, include the Windows API
Code Pack into the project as discussed last month. Once done, you can declare
an instance to use in your application like this:

Direct Hit!

Applies To: .NET developers
USP: Learn to incorporate Jump Lists into
your apps
Primary Link:
Keywords: windows 7, jump lists

JumpList jl;
jl = JumpList.CreateJumpList();
Adding tasks

Now if you wish to create anything on the Jump List, you can simply use this.
For instance, if you wish to add some tasks, you can use the following code:

string systemFolder =

JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
{IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"),

JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
{IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)

jl.AddUserTasks(new JumpListSeparator());
jl.AddUserTasks(new JumpListLink (Path.Combine(systemFolder, "calc.exe"), "Open
{IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)});


The default Jump List for an application on Windows 7.

The code adds three tasks and a separator to the Jump List. The Refresh()
statement makes sure the additions are reflected correctly.

Adding Tasks and a separator to the Jump List for
Categories and destinations allow us to organize and open
items quickly.

Adding Categories and Destinations
Also, we can add some destinations, or files that the application can open.
There are several ways this can be done. For the current scenario, we’ll add
come items automatically into Jump List for the user of the application and also
categorize them. To do this, simply add the following code.

JumpListCustomCategory c1 = new
JumpListCustomCategory c2 = new JumpListCustomCategory("Templates");
jl.AddCustomCategories(c1, c2);

string docFolder =

c1.AddJumpListItems(new JumpListItem(docFolder + "\\key.txt"));
c1.AddJumpListItems(new JumpListItem(docFolder + "\\macros.txt"));

c2.AddJumpListItems(new JumpListItem(docFolder +
"\\Sample Template.txt"));

Ability to use auto-lists such as the ‘Recent’ and ‘Pinned’
known categories with minimum effort.
A full fledged Jump List with tasks, categories,
destinations, pinning and recent auto-list items.

The above code creates two categories on the Jump List and then adds a few
files into each categories. When you run the application, you will be able to
see the Jump List containing these:

Registering File Types and known Categories
One of the most powerful features of the Jump Lists in Windows 7 is the
ability for your application to display the most frequently opened, most
recently opened or user’s most favorite files in the Jump List, so that the user
has a one-click access to them. In older versions of Windows, you would need to
take care of this in code yourself. For instance, to show the most recent files
accessed by your application, you will need to maintain this list yourself. The
same goes for frequent (where the number of accesses would also need to be
stored) and favorites.

Windows 7 manages all of these automatically for you. There are only two
requirements. You must register the file type you wish to open correctly with
Windows so that it can manage the access lists and in the code, you need to tell
Windows which list you wish to display automatically in the Jump List.

When these are done, the application will show the correct set of items in
the Jump List. The Windows API Code Pack has a registration helper code that
lets you register file types to your application. This is normally done during
the installation phase of the application, but can be done at any time. To
register a file type with your app, just use the code like this:

false, ApplicationID, Application.ExecutablePath + " /load %1", ".txt");

This code takes the name of the application, the application ID, the EXE to
use to open the file and the parameters and whether an entry is to be made in
the HKCU part of the registry.
You can now ‘subscribe’ to the auto-lists for your Jump List like this:

Ijl.KnownCategoryToDisplay =

You can use ‘Recent’, ‘Frequent’ or ‘Neither’ to set the type of list you
wish to display. The best part is that the pinning of favorites and user
initiated remove or reorder of the items happens without need for any other

Jump Lists are a great new feature of Windows 7, and once you start using
them they become extremely addictive. Try and add them to your applications as
well, so that the user gets the additional benefit of using your application on
Windows 7.

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.