Click here to Skip to main content
15,888,610 members
Articles / Programming Languages / C#

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

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
1 Apr 2010CPOL 10.5K   6  
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


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

Comments and Discussions

 
-- There are no messages in this forum --