本文介绍了SHOpenFolderAndSelectItems 用于资源管理器替换程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我维护了一个资源管理器/文件管理器工具 (xplorer2),它可以代替 Windows 资源管理器来打开文件夹.但是,我无法捕获 SHOpenFolderAndSelectItems API 执行的打开文件夹并选择项目"操作.

I maintain a explorer/file manager tool (xplorer2) that can replace windows explorer for opening folders. However I cannot trap the "open folder and select item" operation performed by SHOpenFolderAndSelectItems API.

我发现了一个旧线程 由其他一些文件管理器程序员编写,暗示正确的方法是将类似资源管理器"的工具注册为 shell 窗口,然后响应一些查询以提供接口和服务,例如 IWebBrowserApp 将允许项目待选

I found an old thread by some other file manager programmer which implied that the right way is to register the "explorer-like" tool as a shell window, then respond to some queries to supply interfaces and services like IWebBrowserApp that will allow the item(s) to be selected

我就这样成功地向 shell 窗口注册了我的顶级窗口

I registered my top level window with the shell windows successfully as such

CComPtr<IShellWindows> pShellWindows;
HRESULT hr = pShellWindows.CoCreateInstance(CLSID_ShellWindows);
hr = pShellWindows->Register(static_cast<IDispatch*>(this),
    (SHANDLE_PTR)hwTop, /*SWC_3RDPARTY*/SWC_EXPLORER, &m_dwCookie);
ATLASSERT(SUCCEEDED(hr));

如果在 shell 窗口中枚举,该窗口确实会出现.但是,当它作为 SHOpenFolderAndSelectItems 的结果启动时(它在 HKEY_CLASSES_ROOTDirectoryshell 中被声明为资源管理器替代品),不会尝试对注册的 IDispatch 进行 QueryInterface 或任何其他操作.我已经尝试过 SWC_3RDPARTY 和 SWC_EXPLORER 注册标志,但没有任何运气

the window does appear if enumerated among the shell windows. However when it is launched as a result of SHOpenFolderAndSelectItems (it is declared as an explorer replacement in HKEY_CLASSES_ROOTDirectoryshell), there are no attempts to QueryInterface or any other action on the IDispatch registered. I have tried both SWC_3RDPARTY and SWC_EXPLORER registration flags without any luck

任何想法我做错了什么?

any ideas what am I doing wrong?

推荐答案

好的,我想通了.诀窍是真正绕过 有问题的文档

ok, I figured it out. The trick is really going round the buggy documentation

这篇关于SHOpenFolderAndSelectItems 用于资源管理器替换程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-11 14:25