[英]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 文本编辑器编辑的所有文件,即使我根本没有为它编写任何代码。
I think that Windows observes the files you我认为 Windows 观察你的文件
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()
文档的链接。
Here are some resources that I have found useful when making my programs vista ready以下是我发现在准备好我的程序 vista 时有用的一些资源
http://code.google.com/p/theunknownones/wiki/TaskbarListComponents http://www.installationexcellence.com/articles/VistaWithDelphi/Index.html http://www.theabsolute.net/sware/delphivista.html http://code.google.com/p/theunknownones/wiki/TaskbarListComponents http://www.installationexcellence.com/articles/VistaWithDelphi/Index.html http://www.theabsolute.net/sware/delphivista.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.