简体   繁体   English

如何将最近的项目添加到 Windows 7 任务栏上的程序跳转列表?

[英]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.我正在使用 Delphi XE 并想在 Windows 7 任务栏跳转列表中为我的应用程序添加“最近的项目”,例如右键单击 Microsoft Word 时会显示最近打开的文档。 I've found information on how to set the progress but nothing on jump-list items.我找到了有关如何设置进度的信息,但没有找到关于跳转列表项的信息。 Any help would be greatly appreciated.任何帮助将不胜感激。

This will happen automatically if, for instance, you only use the standard Windows file dialogs.例如,如果您只使用标准 Windows 文件对话框,这将自动发生。 At least my text editor, Rejbrand Text Editor , has got such a MRU list by Windows.至少我的文本编辑器Rejbrand Text Editor已经得到了 Windows 这样的 MRU 列表。 It lists all files I have recently edited using Rejbrand Text Editor, even though I have not written any code at all for it.它列出了我最近使用 Rejbrand 文本编辑器编辑的所有文件,即使我根本没有为它编写任何代码。

Windows 7 跳转列表

I think that Windows observes the files you我认为 Windows 观察你的文件

  • open and save in your application by means of standard Windows file dialogs通过标准 Windows 文件对话框打开并保存在您的应用程序中
  • open in your application by starting yourapp.exe <file name> , for instance by double-clicking a file that opens in your application通过启动yourapp.exe <file name>在您的应用程序中打开,例如通过双击在您的应用程序中打开的文件

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.如果您想以编程方式控制任务栏按钮和菜单,可以使用 Windows API。 Delphi-specific examples are found in this blog post . Delphi 特定示例可在此博客文章中找到。

In my opinion the best way to do this is to make the following simple API call:在我看来,最好的方法是进行以下简单的 API 调用:

  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.这不仅处理 Windows 7 跳转列表,而且还将您的文件添加到系统的最近使用文档列表中,这对 Windows 的早期版本也有影响。

Call the function whenever you open or save a file.每当您打开或保存文件时,请调用 function。

For your convenience, a link to the documentation of SHAddToRecentDocs() .为方便起见,提供SHAddToRecentDocs()文档的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让我的程序在Windows Vista和Windows 7中运行? - How do I make my program work in Windows Vista and Windows 7? 如何判断Windows任务栏的“自动隐藏”是否已启用? - How to tell if Windows Taskbar's “autohide” is enabled? 无法从 Windows 任务栏恢复最小化的程序 - Cannot restore minimized program from Windows Taskbar 如何使我的Deskband(任务栏工具栏)表单透明 - How to make my Deskband's (Taskbar Toolbar) Form transparent 如何在Windows 7启动时以不同的特权运行程序? - How do I make my program run with different privileges at Windows 7 startup? 我需要将Midaslib添加到我的mac程序中吗? - Do I need to add Midaslib to my mac program? 如何停止在任务栏上显示我的应用程序? - How can I stop my application showing on the taskbar? 如何获取应用程序的Windows任务栏按钮以显示进度条的进度 - How to get application's Windows taskbar button to show progress of progress bar 如何在运行时从任务栏中隐藏我的任务栏图标? - How to hide my TaskBar icon from the TaskBar at run-time? 为什么在我的 Delphi 程序中调用 Windows API 时会发生堆栈溢出? - Why do I get a stack overflow when I call the Windows API from my Delphi program?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM