SHOpenFolderAndSelectItems用于资源管理器替换程序 [英] SHOpenFolderAndSelectItems for explorer replacement program

查看:97
本文介绍了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.

我找到了旧线程由其他文件管理器程序员暗示,正确的方法是将类似于Explorer的工具"注册为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_ROOT \ Directory \ shell中声明为资源管理器替换)而启动它时,不会尝试对已注册的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_ROOT\Directory\shell), 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用于资源管理器替换程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆