SHAddToRecentDocs 没有文件?
我正在研究一个 IRC 客户端,将其与 Windows 7 应用栏集成。
要获取“频繁”或“最近”项目列表,必须调用 SHAddToRecentDocs API。 我想将最近访问的 IRC 频道添加到 IRC 应用程序的 Windows 7 跳转列表中。 现在,我的问题是,文件系统中不存在 IRC 频道。 SHAddToRecentDocs 似乎坚持获取某种文件系统对象。
我尝试通过创建指向我的应用程序的 IShellItem 并为其提供启动通道的命令行来解决此问题。然而 shell 正在反叛,到目前为止还没有明显地将我的任何“最近文档”尝试添加到跳转列表中。
有没有办法在不创建某种完全不需要的文件系统对象的情况下做到这一点?
I was toying with an IRC client, integrating it with the windows 7 app bar.
To get a "Frequent" or "Recent" items list one has to call SHAddToRecentDocs API.
I want to add recent IRC channels visited to the Windows 7 Jumplist for the IRC application.
Now, my problem is, IRC channels don't exist in the file system. And SHAddToRecentDocs seems to insist on getting some sort of file system object.
Ive tried to work around it by creating a IShellItem pointing to my application, and giving it a command line to launch the channel. The shell is rebelling however, and thus far has not visibly added any of my "recent document" attempts to the Jumplist.
Is there no way to do this without creating some kind of entirely unwanted filesystem object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题 1671793 完成了一部分。您需要一个
IShellLink
而不是IShellItem
。我一点一点地尝试了该代码。在使用IPropertyStore
设置标题之前,一切都无法进行。IPersistFile
代码似乎没有必要。综上所述,虽然现在当我右键单击应用程序的任务栏图标时会出现一些项目,但我还没有将它们作为我的应用程序的子菜单显示在开始菜单上(例如,像 word 文档那样) ),所以我还不太满意。我认为这是
SHAddToRecentDocs
文档中警告的结果:这是我的代码。我正在经历一些困难,因为我的开发环境使用的是较旧的 Windows SDK(所以我必须为自己创建 PKEY_Title),并且我的应用程序需要支持 Win2k(所以我不想绑定到像
InitPropVariantFromString 这样的函数
需要较新的 Windows 版本)。The code in the answer to question 1671793 goes part of the way. You want an
IShellLink
instead of anIShellItem
. I tried that code bit by bit. Things wouldn't work before using theIPropertyStore
to set the title. TheIPersistFile
code doesn't seem to be necessary.All of that said, while I now have items appearing when I right-click on my app's taskbar icon, I don't yet have them appearing as a sub-menu of my app on the start menu (as word docs do, for example), so I'm not yet entirely satisfied. I think this is a result of the warning in the docs for
SHAddToRecentDocs
:Here's my code as it stands. I'm jumping through some hoops as my development environment is using an older Windows SDK (so I have to create PKEY_Title for myself) and my app needs to support Win2k (so I don't want to bind to functions like
InitPropVariantFromString
which require newer Windows versions).