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:
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.
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