jonjbar
jonjbar

Reputation: 4066

How do I add recent items to my program's jump list on the Windows 7 taskbar?

I'm using Delphi XE and would like to add "recent items" in the Windows 7 taskbar jump list for my application, like when right-clicking on Microsoft Word brings up recently opened documents. I've found information on how to set the progress but nothing on jump-list items. Any help would be greatly appreciated.

Upvotes: 4

Views: 4121

Answers (3)

Andreas Rejbrand
Andreas Rejbrand

Reputation: 108948

This will happen automatically if, for instance, you only use the standard Windows file dialogs. At least my text editor, Rejbrand Text Editor, has got such a MRU list by Windows. It lists all files I have recently edited using Rejbrand Text Editor, even though I have not written any code at all for it.

Windows 7 jump list

I think that Windows observes the files you

  • open and save in your application by means of standard Windows file dialogs
  • open in your application by starting yourapp.exe <file name>, for instance by double-clicking a file that opens in your application

and automatically display these in the list.

If you want to control the task bar button and menu programmatically, you can use the Windows API. Delphi-specific examples are found in this blog post.

Upvotes: 7

David Heffernan
David Heffernan

Reputation: 612934

In my opinion the best way to do this is to make the following simple API call:

  SHAddToRecentDocs(SHARD_PATH, PChar(FileName));

This not only deals with Windows 7 jump lists but also adds your file into the system's list of recently used documents which has an effect on early versions of Windows too.

Call the function whenever you open or save a file.

For your convenience, a link to the documentation of SHAddToRecentDocs().

Upvotes: 4

Related Questions