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.
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.
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?
regards, Madhu
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.
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.
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.
来源:https://stackoverflow.com/questions/20975679/icon-overlay-handlers-for-namespace-extension