folders默认配置 shell_是否可以继承默认的IShellFolder实现?

bd96500e110b49cbb3cd949968f18be7.png

I'm trying to implement a shell namespace extension, for the sole purpose of overriding the thumbnail handler (IExtractImage) in a specific folder. I want everything else to be the same as in a normal folder, and I'd rather not have to reimplement everything that is done in the default implementation of IShellFolder...

So, is it possible to inherit from this default implementation? If so, how?

Using composition would also be an acceptable solution, but how can I get an instance of the class for a given folder?

解决方案

1) There many shell extensions which can request your files content. For example .ico-file icon handler. Also user can install for example info tip extension which shows ID3 tag from mp3 file and it requests file content too. User can setup additional columns in detail view and some of them request file content. So you must control a lot of details in your shell name space extension.

2) To create a default implementation just call CoCreateInstance(CLSID_ShellFileSystemFolder, nil, CLSCTX_INPROC_SERVER, IID_IShellFolder, ShellFolder).

3) There is a problem. For example:

Shell queries unknown IShellFolder3 from your NSE.

Your NSE does not implement IShellFolder3 and NSE queries IShellFolder3 from default implementation and returns the result.

Shell call IShellFolder3.GetUIObject with IID_IExtractImage and default IShellFolder3 will return installed thumbnail handler.

Also such methods can lead to AV inside Explorer (from my practice).

So I believe that your NSE must implement all known interfaces implemented by default implementation. If you don`t want to change behavior of method just pass the parameters to default implementation. Known (by me) interfaces: IBrowserFrameOptions, IOleCommandTarget, IPersist, IPersistIDList, IPersistFolder, IPersistFolder2, IPersistFolder3, IParentAndItem, IShellFolder, IShellFolder2, IObjectWithFolderEnumMode, IShellDetails, IShellFolderViewCB, IFolderFilter, INameSpaceTreeControlFolderCapabilities, IShellIcon, IShellIconOverlay, IFolderType, IFolderViewSettings, IExplorerPaneVisibility, IPropertyStoreFactory, IPropertyStore, IItemNameLimits, IThumbnailFactory.

4) As i understand you must control requests of following interfaces: IDataObject, IDropTarget, IExtractIconA(W), IExtractImage, IPropertyStore, IPropertyStoreFactory, IShellFolder(2), IQueryInfo.

5) IShellIcon.GetIconOf must return default icon of extension.

6) Also if your folder contains subfolders don`t forget to return your implementation when shell requests IShellFolder(2) of subfolder.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值