The Windows 7 Shell populates and manages the Recent and Frequent destination

    The article was added by Frank Y. at 01/27/2010.

  Submit | About | Contact & Privacy Policy

You are here: Articles Directory » Windows 7

Bookmark and Share

The Windows 7 Shell populates and manages the Recent and Frequent destination categories. Simple mechanisms govern the definition of what a recent or frequent item might be and performing integration tasks with these mechanisms does not require any interaction with taskbar-specific APIs.

If your application has a well-defined file type, your application’s installer should register this file type to associate it with your application. This association is recorded in the Windows 7 registry, under the HKEY_CLASSES_ROOT registry hive. Even if your application is not the primary handler for the file type (for example, Microsoft Visual Studio can open XML documents, but it’s not necessarily the primary handler for .xml files), you should still associate it with file types that it can open.

Associating Your Application with a File Type

To associate your application with a file type, you need to fill the registry entries under the HKEY_CLASSES_ROOT registry hive. Specifically, you need to create a key with your file extension (for example, .xml) and a subkey called OpenWithProgIds. Within the subkey, create a string value with your ProgID in the standard ProgID format (for example, VisualStudio.9.0).

Note The following MSDN page offers a detailed walkthrough of this process: http://msdn.microsoft.com/en-us/library/cc144148(VS.85).aspx. Additionally, you might find useful the Windows 77.DesktopIntegration.RegistrationHelper utility, which performs the necessary steps to register a file type association in the Windows 7 registry. (The utility is available as part of the Windows 7 7 Taskbar Sample Library.)

Next, create another key under the HKEY_CLASSES_ROOT registry hive with the name of the ProgID used in the previous steps. Under that key, add subkeys to form the following path: shell\Open\Command. Within the Command subkey, add a default string value with the full path to your executable and additional command-line parameters if desired. Within the command-line string, you can use the %1 placeholder, which the Windows 7 Shell replaces with the name of the document being opened. The following screen shot is an example of a registry association for the .ascx file extension with the Visual Studio ProgID.

If you successfully followed these steps, the Windows 7 Shell recognizes your application as a handler for the specified file type. Successful completion of these steps enables users to launch your application by double-clicking items with your file extension in Windows 7 Explorer, and it enables you to embed destinations in your application’s Jump List.

Windows registry editor

The Windows 7 Shell adds items to the Recent and Frequent lists for your application when one of the following actions occurs:

  • The item is used to launch your application directly for example, when you double-click a file or a shortcut in Windows 7 Explorer.
  • The item is selected by a user in a common file dialog (Open or Save).
  • The item is passed as a parameter to the SHAddToRecentDocs function, which is part of the Windows 7 Shell API.

Note Common file dialogs provide a standard look and feel as well as additional functionality to Open and Save operations throughout the Windows 7 Shell. Applications that use the common file dialogs will always benefit from the latest version of the user interface provided by the underlying operating system (regardless of the version of Windows 7 they were compiled on). Taking advantage of Windows 7 Shell Libraries and of Recent and Frequent categories is greatly simplified if you use common file dialogs in your application. For more information about common file dialogs, consult the MSDN documentation.

The first two actions do not require any interaction on your application’s behalf the Windows 7 Shell automatically maintains the Recent and Frequent item lists for your application. Therefore, if your Jump List contains the Recent or Frequent destination category and your application is registered as a handler for some file type, the application’s Jump List automatically contains recently or frequently accessed items. If you choose to notify the Windows 7 Shell directly, you can use the SHAddToRecentDocs Win32 API or the managed equivalent the JumpList.AddToRecent method which is part of the Windows 7 API Code Pack. This has the same effect as populating the Jump List with the recently or frequently accessed items.

The only thing left to do, then, is to let the taskbar know that your application requires a Jump List with one of the system destination categories Recent or Frequent. Remember that to display the Jump List correctly and associate it with the appropriate taskbar button, you need to set the window application ID (or the process application ID) to the same consistent value you use throughout your application.

If you decide to use the Recent destination category, you don’t need to do anything else to get the Jump List to work. However, if you want to use the Frequent destination category, you need to follow through with a list-building transaction. The following code sample, which displays both the native and managed APIs, shows how to create a Jump List for an application, add to it the Frequent destination category, and ensure that it’s populated with one recently used item:

//C++:
   ICustomDestinationList* pJumpList = NULL;
   if (FAILED(CoCreateInstance(
   CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pJumpList))))
   goto Cleanup;
   if (FAILED(pJumpList->SetAppID(L"Microsoft.Samples.MyApplication")))
   goto Cleanup;
   UINT uMaxSlots;
   IObjectArray* pRemoved;
   if (FAILED(pJumpList->BeginList(&uMaxSlots, IID_PPV_ARGS(&pRemoved))))
   goto Cleanup;
   if (FAILED(pJumpList->AppendKnownCategory(KDC_FREQUENT)))
   goto Cleanup;
   if (FAILED(pJumpList->CommitList()))
   goto Cleanup;
   Cleanup:
   if (pJumpList != NULL)
 pJumpList->Release();
//C#:
 JumpList jumpList = JumpList.CreateJumpList();
 jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Frequent;
 jumpList.AddToRecent("MyFile.ext");
 jumpList.Refresh();

After completing these steps, your application will have a Jump List with the Recent or Frequent category enabled. If your users are using Windows 7 Explorer to launch your application from individual items, and if you’re using the common file dialogs for Open and Save functionality, there’s nothing else you need to do to manage the Recent and Frequent categories.

It usually doesn’t make sense to include both the Recent and Frequent categories in the same Jump List. It is recommended that you choose one or the other.

Windows 7 Disclaimer

  • The ArticleCity.info articles directory team is not responsible for falsehoods, inaccuracies, or any other types of misinformation this article may contain and will not be liable for any damage or loss suffered by a user through the user's reliance on the information gained here.
  • ArticleCity.info articles directory is not responsible for any and all copyright infringements by writers and authors. If you suspect the information contained by this page for any copyright infringements, please contact us and we'll investigate the specific article(s) and we will remove the copyrighted material.
Other Windows 7 articles
Locating and Use Files and Folders in Windows 7 - Locate and Use Files and Folders The purpose of a file system, of course, is to locate and use the files and folders on your computer, and possibly on other computers connected to yours. Within your computer, there is...
Encrypt files and folders and cleaning disks in Windows 7 - Encrypt Files and Folders Windows 7 Professional, Enterprise, and Ultimate editions, but not Windows 7 Starter, Home Basic, or Home Premium editions, have the ability to encrypt files and folders so that they canno...
Windows 7 How to connect to the Internet Step by Step - Connect to the Internet You can connect to the Internet using a telephone line, a cable TV connection, a satellite link, or a land-based wireless link. Across these various types of connections there are a myriad o...
Windows 7 does not include a mail program use Windows Live - Use Internet Email Windows 7 does not include a mail program, but you can download Windows Live Mail...
Internet connection types available for connecting to Internet - TYPES OF INTERNET CONNECTIONS The following Internet connection type descriptions give you a starting place for determining the type you want, if it is available to you. The speeds and costs are representative averages and ...
Recent and Frequent destination categories provided by the Windows 7 Shell - Custom Destinations If the default Recent and Frequent destination categories provided by the Windows 7 Shell are not enough for your application, you’ll want to create custom categories and store your destinations within them....
User tasks in Windows 7 and applications - User Tasks User tasks despite their name are additional tasks that can be placed in your application’s Jump List. These are verbs that can invoke your application or any other application, and they’re usually repres...
Windows 7 Thumbnail toolbars are an exceptional productivity feature - Thumbnail Toolbars Thumbnail toolbars are an exceptional productivity feature that gives users the ability to do more with the application’s thumbnail without switching to the application’s window and interrupting t...
Customizing Windows 7 Thumbnail ToolTips - Customizing Thumbnails One of the most visually stunning features of the Windows 7 7 desktop is the multiple live thumbnails shown for each taskbar button (as shown in the following screen shot). The new taskbar thumbnails are mu...
Thumbnail Dimensions in Windows 7 - Thumbnail Dimensions The lParam parameter received by the window procedure for the WM_DWMSETICONICTHUMBNAIL message specifies the width and height of the requested thumbnail the width is the high-order word, and the height is t...