Jumping into Windows 7 Jump Lists


Filed under "Little changes that you probably didn't notice".

When Microsoft introduced Windows 7 to the desktop, one of the many usability features that they added were "Jump Lists". Jump Lists serve as a sort of shortcut to not just open an application, but "jump right in" to a particular feature or document that the application knows how to manage. It's all about convenience and reducing the number of clicks necessary to accomplish a task.

When developing SAS Enterprise Guide 4.3, we hooked into the "recent documents" aspect of the Jump List for two types of documents: project files (.EGP) and SAS programs (.SAS). Both of these are also easily accessible in SAS Enterprise Guide under File->Recent Projects and File->Recent Programs (new in 4.3).

If you use SAS Enterprise Guide often, you can drag the program icon to your Windows 7 task bar and "pin" it in place for convenience.  Then you can right-click on that icon to see a list of recently accessed projects and/or programs.

How to hook into the Jump List

The remainder of this post is aimed toward other application developers, as it describes how to hook into the "recent documents" feature of Windows, which automatically puts your documents in your application's Jump List. It's technical and it features .NET C# code, so if that's not your interest, then you may be excused.

To hook into the "recent documents" list, you need to call some Windows APIs -- specifically, the SHAddToRecentDocs routine within Shell32 (yes, even on a 64-bit system). That means you have use "platform invoke", or pinvoke, within .NET.

To use pinvoke, you first declare a .NET routine to wrap the call to the operating system. Then, you use that routine when appropriate from within your application. At the end of this post I included an example of a C# class to wrap the SHAddToRecentDocs routine, and a helper routine (AddToRecentDocs) to make it easy to use.

In your application, when the end user successfully opens or saves a document (whatever that might be for your application), you can then call the new routine to "register" that document. For example:

public void SaveDocument(string docFullpath)
  // statements to save the document to disk go here
  // ...

When used, all "recent document" items are added to the Windows registry at:
The names are organized by file extension and are stored as binary blobs, so you might be able to verify that new files show up by examining the registry, but you probably cannot just eyeball it for specific entries.

Here's the wrapper class:

/// pinvoke wrapper for adding a local file to the "Recent Documents" list
/// in the Windows shell.
/// Source: pinvoke.net
/// http://www.pinvoke.net/default.aspx/shell32/SHAddToRecentDocs.html
sealed public class ShRecentDocs
    private ShRecentDocs() { }
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")]
    public enum ShellAddToRecentDocsFlags
        Pidl = 0x001,
        Path = 0x002,
    [DllImport("shell32.dll", CharSet = CharSet.Ansi)]
    public static extern void
      SHAddToRecentDocs(ShellAddToRecentDocsFlags flag, string path);
    public static extern void
      SHAddToRecentDocs(ShellAddToRecentDocsFlags flag, IntPtr pidl);
    /// This is the simple function to call to add a document to the list
    public static void AddToRecentDocs(string path)
        SHAddToRecentDocs(ShellAddToRecentDocsFlags.Path, path);

About Author

Chris Hemedinger

Director, SAS User Engagement

+Chris Hemedinger is the Director of SAS User Engagement, which includes our SAS Communities and SAS User Groups. Since 1993, Chris has worked for SAS as an author, a software developer, an R&D manager and a consultant. Inexplicably, Chris is still coasting on the limited fame he earned as an author of SAS For Dummies


  1. hello
    i need help to progamer a code with SAS, to generate a sample and its corresponding estimator boostrap.
    the code is.
    LET X=(X_1,X_2,...,X_n) BE THE ORIGINAL DATA.
    SET I=1
    1. DRAW U_1,...,U_N~U(0,1) IID, SET L_j=[N*U_j] (minimum integer greater than or equal to)
    AND X*_i=X_(L_j), j=1,2,...n
    2. SET X*_i=(X*_1,...,X*_n) AND T*_i=T(X*_i) (Statistics or estimates).
    3. IF i

Back to Top