Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Anatomy of the Windows 7 taskbar – Jumplist (Part 2)

0.00/5 (No votes)
1 Apr 2010 1  
If your application is associated with a specific file extension, then you get the last part for free! The taskbar also lists files opened by your application in the Recent category!

If your application is associated with a specific file extension, then you get the last part for free! The taskbar also lists files opened by your application in the Recent category!

To check if your file extension is associated with your application, open your registry editor and navigate to HKEY_CLASSES_ROOT and search for your extension!

Here is a code snippet to check:

C#
RegistryKey openWithKey = Registry.ClassesRoot.OpenSubKey
		(Path.Combine(".wpost", "OpenWithProgIds")); 
string value = openWithKey.GetValue(progId, null) as string; 

if (value == null) 
{ 
   // No extension registered 
} 
else 
{ 
   // File extension is registered 
}

Registering a file extension is extremely easy using the RegistrationHelper:

C#
string executablePath = Assembly.GetEntryAssembly().Location; 

RegistrationHelper.RegisterFileAssociations( 
   "LiveWriter", 
   false, 
   "LiveWriter", 
   executablePath + " /doc %1", 
   ".wpost");

To manually report file usage to shell, call AddToRecent:

C#
jumpList.AddToRecent(fileName);

Note: The dialog box automatically reports usage to shell, but it's still recommended that the user explicitly call AddToRecent. Shell will automatically handle duplicate additions.

And that’s it…

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here