gpt4 book ai didi

c++ - 如何获取 IShellFolder 的 PIDL

转载 作者:可可西里 更新时间:2023-11-01 18:09:54 25 4
gpt4 key购买 nike

如果我有一个IShellFolder 接口(interface)指针。我怎样才能获得它的 PIDL?

我可以看到如何枚举它的 child ,我可以看到如何用它来比较任何两个 child 。但是我怎样才能得到它自己的 pidl?

我问是因为我想知道:

Is this IShellFolder == Another IShellFolder

我可以使用 IShellFolder::CompareIDs(),但我必须拥有两个文件夹的 ID。

最佳答案

Chris 或 Mordechai 在 #1 上写的内容无论如何都不是重点。问题不在于 shell 命名空间中的对象,而在于具有 IShellFolder 接口(interface)的对象。拥有 IShellFolder 接口(interface)本身并不意味着存在于 shell 命名空间中。原始问题的格式不正确,因为它假定具有 IShellFolder 接口(interface)的对象必须具有 “它自己的 PIDL”

我认为,你能做的最好的就是像 Mordechai 建议的那样:

  • 查看对象是否也有一个IPersistFolder2接口(interface)

此接口(interface)的目的是修复 shell 命名空间中的对象,这反过来又使文件夹持久化。与其从缺少已发布的文档来推断,不如看看微软实际上对 IPersistFolderIPersistFolder2 接口(interface)以及 InitializeGetCurFolder 方法。最值得注意的是:

you need to implement this interface so that the Shell folder object's ITEMIDLIST can be retrieved.

关于第 2 点,恐怕 Chris 肯定是不正确的。 IShellFolder 当然可以在没有 PIDL 的情况下获得。 Chris 为#1 介绍的控制面板为#2 提供了现成的反例。只需将 CLSID_ControlPanelIID_IShellFolder 提供给 CoCreateInstance。您无需“了解 PIDL” 即可获得完美可用的控制面板实例。

在 SHELL32 中实现了一些其他可创建的 shell 文件夹,任何 DLL 都可以设置任意数量的其他文件夹。

关于c++ - 如何获取 IShellFolder 的 PIDL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1766275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com