Shell Icon Overlay (C#)

Shell overlay icon is not displayed

You are probably running into a similar issue to what is talked about in this thread. Tortoise-svn icons not showing up under windows 7

Shell Icon Overlay (C#)

Tigris' TortoiseSVN product heavily uses icon overlays provided by library shared by several Tortoise products, the overlays themselves are written in C++ rather than C#.

The documentation for the TortoiseOverlays project explains how they use it and the problems they have encountered (username: guest, empty password), and the GPL'ed sourcecode is in the Subversion repository (same username/password as above).

Snippit from documentation:

TortoiseOverlays registers itself with the explorer to handle the nine
states mentioned above, i.e. it registers nine overlay handlers. The
explorer process initializes the TortoiseOverlays handler, calling its
IShellIconOverlayIdentifier::GetOverlayInfo(). TortoiseOverlays looks
for the registered overlay handlers under
HKLM\Software\TortoiseOverlays\Statusname and calls their
GetOverlayInfo() method so they can initialize too (Note that any
change to the icon name, index, ... your handler does are overwritten
later and won't be used - it's TortoiseOverlays that handles the icons
now). After the initialization, TortoiseOverlays relays every call to
its IShellIconOverlayIdentifier::IsMemberOf() method to the other
handlers. The first handler that returns S_OK determines whether the
icon is shown or not.

Icon overlay in c#

(edit: fixed regsvr32 to regasm, sorry for my mistake)

This code has three main parts:
1) An interop signature for the IShellIconOverlayIdentifier, the interface used by the shell to add icon overlays.
2) MyOverlay, an implementation of that interface, adding (I'm guessing) the "normalIcon.ico" as the overlay.

3) (this is the important part) code to register and unregister MyOverlay as a shell extension in the registry.

I'm not too familiar with the specifics of icon overlays, but it seems that to enable this you need to call the Register method. Since it's marked with a [ComRegisterFunction], I'm guessing all you have to do, from a command prompt with admin privileges, is call

C:\> regasm <path to your DLL>

which should call Register. Likewise with regasm /u <path> to uninstall. Give it a try.

How to use the registered shell overlay icon from TortoiseSVN in my c# app

After regarding some solution ive found "TortoiseOverlays" projects that used in TortoiseSvn project

here is my another question to resolve the usage of this hooks How to use TortoiseOverlays with my own handler

How to resize Windows Icon Overlay?

You can't change the overlay size. Instead use a multi-resolution icon file where all necessary sizes are available.

For a good example take a look into the source of TortoiseSVN. Their will be only one icon file used, but if you open it with an appropiate paint tool, you'll see that this file contains different sizes.

Update

If you take a look right at the first method, you'll get the following comment:

"The Shell calls IShellIconOverlayIdentifier::GetOverlayInfo to request the
location of the handler's icon overlay. The icon overlay handler returns
the name of the file containing the overlay image, and its index within
that file. The Shell then adds the icon overlay to the system image list."

You can see in line 129 that it tries to find out the path of the needed file from the registry. By browsing the code you can find the icons in subversion here. In line 165 you can see that it takes the filename from the registry and writes it back to its out parameters and maybe the magic flag to let windows decide which size should be taken from the file is *pdwFlags = ISIOI_ICONFILE;.

Setting the taskbar overlay icon with programmatically created

From the Remarks section of TaskbarItemInfo.Overlay:

The overlay is not displayed if the
user sets the taskbar to show small
icons



Related Topics



Leave a reply



Submit