Click here to Skip to main content
15,880,725 members
Articles / Programming Languages / C#
Article

Updating Jumplists On The Fly

Rate me:
Please Sign up or sign in to vote.
4.62/5 (43 votes)
2 Feb 2010CPOL2 min read 32K   294   20   3
This article shows the basics of using jumplists; creating tasks in them linking to another excutable and updating them on the fly.

Introduction

This is a beginner's article to show how to get up and running with the new Windows 7 feature called Jumplists. When we finish, you should be able to create jumplists on the fly and add tasks to them.

Using the Code

The main jumplist code is in the form. There are a few things you need to download to use the Windows 7 API and get the DLL you need in order to start using the fun stuff in Windows 7 like Jumplists. The API link is here. Once you download it, you need to compile the DLL and then add a reference to it in your current project. The final bit to getting the jumplists to work is making sure to include the proper using syntax for them. In our case with Jumplists, you want to include:

C#
using MS.WindowsAPICodePack.Internal;
using Microsoft.WindowsAPICodePack.Shell;	
using Microsoft.WindowsAPICodePack.Taskbar;

Once you get the includes figured out, you can jump in and create one. Make sure you create the jumplist in the FormShown event and then just add tasks as needed. The syntax below is how to create a simple task and pass an argument as well as set the icon.

C#
IEPath = String.Format("C:\\Program Files\\Internet Explorer\\iexplore.exe");
					
JumpListLink jll = new JumpListLink(IEPath, s);
jll.IconReference = new IconReference(IEPath, 0);
jll.Arguments = txtURL.Text;

jumpList.AddUserTasks(jll);

The included demo was created to be minimized most of the time. It will scrape the current NHL.com scores site and then add the list of the current games onto a separate jumplist with a link back to the scores page. Once the timer is started, it will update the scores every timer tick which can be set in the numeric spin dial.

Once you let it run, it will update the jumplist with the current scores of the day. When you right click to get access to the jumplist, you will see something similar to the following:

Points of Interest

One tip that I learned when doing this is that you need to make sure that the icon reference is set, otherwise you get a very ugly non recognizable icon next to your tasks.

As you can see, jumplists are handy tools to get access to various items and provide extra functionality to your program. One caveat, since this was a demo I didn't follow the proper Microsoft best practices with Jumplists. You should make sure that the functionality of the jumplists are also included inside your application. In other words, anything you do in jumplists should be able to be done inside your program as well.

History

  • Initial upload: 1-31-10

License

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


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 2 Pin
FantasticFiasco15-Feb-10 9:36
FantasticFiasco15-Feb-10 9:36 
GeneralMy vote of 2 Pin
Phil J Pearson5-Feb-10 23:06
Phil J Pearson5-Feb-10 23:06 
GeneralMy vote of 1 Pin
j.avery5-Feb-10 10:15
j.avery5-Feb-10 10:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.