命名空间扩展的图标覆盖处理程序 [英] icon overlay handlers for namespace extension

查看:24
本文介绍了命名空间扩展的图标覆盖处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发命名空间扩展,它提供服务器上文件的虚拟视图.在此视图中,我需要使用覆盖图标提供文件的不同状态(使用中、离线、不同步等).

I am developing namespace extension which gives a virtual view of files on a server. In this view, I need to provide different states(in use, offline, out of sync, etc) of a file using overlay icons.

我阅读了实现覆盖处理程序的文章,并认为我会尝试在我们的一个覆盖处理程序中处理这个问题,它实现了 IShellIconOverlayIdentifier 接口.

I was read through article implementing overlay handler, and thought I will try to handle this in one of our overlay handlers, which implement IShellIconOverlayIdentifier interface.

我看到 IShellIconOverlayIdentifier::IsMemberOf() 和其他函数仅在我访问普通文件系统(即 c:、d: 等)上的文件时调用.当我浏览命名空间扩展时,这些调用不会被调用根本.这是为什么?如何为 Namespace 扩展中的对象实现覆盖?

I see that IShellIconOverlayIdentifier::IsMemberOf(), and other functions are called only when I access files on normal filesystem, i.e., c:, d: etc. When I browse a namespace extension, these calls are not called at all. Why is that? How do I implement overlays for objects in Namespace extension?

问候,马杜

推荐答案

添加覆盖图标的唯一方法是实现 IShellIconOverlay 在您的 NSE 中.但问题是 IShellIconOverlay.GetOverlayIndex 和 IShellIconOverlay.GetOverlayIconIndex 必须返回从 SHELL 图像列表接收的图标.可以使用 SHGetIconOverlayIndex 函数接收来自外壳图像列表的覆盖图标.并且没有方法可以将额外的覆盖图标添加到外壳图像列表中.

The only way to add an overlay icon is implement IShellIconOverlay in your NSE. But the problem is that IShellIconOverlay.GetOverlayIndex and IShellIconOverlay.GetOverlayIconIndex must return icons received from SHELL image list. Overlay icons from shell image list can be received with SHGetIconOverlayIndex function. And there is NO way to add additional overlay icon into shell image list.

如果您想使用标准的覆盖图标,如链接或分享图标,只需使用 SHGetIconOverlayIndex.但是如果你想使用自定义图标,你必须使用hack".Hack 是简单的附加覆盖外壳扩展.只有覆盖外壳扩展可以在外壳图像列表中添加额外的覆盖图标.在 IShellIconOverlayIdentifier.GetOverlayInfo 中,您将返回您的图标和索引,IShellIconOverlayIdentifier.IsMemberOf 将始终返回 S_FALSE.在 IShellIconOverlay_GetOverlayIndex 中的 NSE 中,您将使用您的图标和索引调用 SHGetIconOverlayIndex.

If you want to use standard overlay icons like link or share icons just use SHGetIconOverlayIndex. But if you want to use custom icons you must use "hack". Hack is simple additional overlay shell extension. Only overlay shell extension can add additional overlay icon into shell image list. In IShellIconOverlayIdentifier.GetOverlayInfo you will return your icon and index, IShellIconOverlayIdentifier.IsMemberOf always will return S_FALSE. Inside NSE in IShellIconOverlay_GetOverlayIndex you will call SHGetIconOverlayIndex with your icon and index.

您必须为每个图标使用单独的覆盖外壳扩展.但是不要忘记 Windows 有系统中注册的覆盖外壳扩展的最大计数限制.我不记得确切的数字,但大约是 15 个.

You must use separate overlay shell extension for every icon. But dont forget that Windows has limit of max count of overlay shell extension registered in the system. I dont remember exact number but it is about 15.

这篇关于命名空间扩展的图标覆盖处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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