3

I created Icon Overlay Handlers using sharpshell as this sample:- http://www.codeproject.com/Articles/545781/NET-Shell-Extensions-Shell-Icon-Overlay-Handlers

My Sharpshell handler is

[ComVisible(true)]
[DisplayName("  Test")]
public class SyncedIconOverlayHandler : SharpIconOverlayHandler    
{
...
}

My Question is i want to change the handler name to contain space before name so, my handler will take precedence before Dropbox and Google Drive. enter image description here

Karl Gjertsen
  • 4,690
  • 8
  • 41
  • 64
yo2011
  • 971
  • 2
  • 12
  • 38

4 Answers4

1

Don't take a space. Take an A or a _ (Underscore).

Oliver
  • 43,366
  • 8
  • 94
  • 151
  • Hi Oliver, I want to know how to do this programtically. i used the attribute DisplayName but nothing happened [ComVisible(true)] [DisplayName(" ColiboSynced")] public class ASyncedIconOverlayHandler : SharpIconOverlayHandler {} – yo2011 Jan 13 '16 at 08:10
1

This is not about creating the overlay, this is about the sort order that is used in the list of Overlay Identifiers. To change where your name appears, you would need to change the name of your identifier to start with a letter before D, as DropboxExt1 is the first item. So instead os using " Test", give it another name.

Using a space isn't the way to go. A good approach for this is to start the name with the underscore _ character, which will appear in the list before the letter A. this will ensure it remains at the beginning if any future identifiers are added.

Karl Gjertsen
  • 4,690
  • 8
  • 41
  • 64
  • Hi Karl, I want to know how to do this programtically. i used the attribute DisplayName but nothing happened [ComVisible(true)] [DisplayName(" ColiboSynced")] public class ASyncedIconOverlayHandler : SharpIconOverlayHandler {} – yo2011 Jan 13 '16 at 08:11
  • Can you add some of your code here instead of as a link.If the link stops working, the question will not help others who have asimilar problem. :-) – Karl Gjertsen Jan 13 '16 at 08:12
  • I can see it now. Can you see my amended answer. – Karl Gjertsen Jan 13 '16 at 08:22
  • You mean i updated the class name itself, not the attribute DisplayName – yo2011 Jan 13 '16 at 08:25
  • What name is appearing in the ShellIconOverlayIdentifiers list. You don't show it. – Karl Gjertsen Jan 13 '16 at 08:27
  • The name that appear is the class name not the display name attribute – yo2011 Jan 13 '16 at 08:28
  • Yes, If i change class name, it will affect the registry name but i don't want to change class name itself, i want other things such as DisplayName attribute – yo2011 Jan 13 '16 at 08:31
  • Does the SharpShell documentation say this is how to do it? – Karl Gjertsen Jan 13 '16 at 08:32
  • The simplest solution would be to rename your class name. Is there a reason you want your name to appear in the top of the list. I thought this was just the alphabetic list, not an order of precedence. – Karl Gjertsen Jan 13 '16 at 08:39
  • Thanks, i will stick with renaming class name – yo2011 Jan 13 '16 at 10:32
  • Good luck! If this has helped, please accept it as the answer. – Karl Gjertsen Jan 13 '16 at 10:33
  • Thanks, but this isn't what i want. i already know that changing class name will affect the COM name. so , i will n't mark it as solved – yo2011 Jan 13 '16 at 10:37
  • Actually using a space is the way to go and what most icon overlays do now (TortoiseSVN, Google Drive, Dropbox) trying to be in the top 15 that show! "_" is sorted after space - just tried. – markmnl May 10 '16 at 03:20
1

You can as you know append spaces to the name to sort your overlay above others - many common Icon Overlays do e.g. Google Drive, Dropbox and Tortoise SVN.

The precedence in sorting is because only the top 15 as sorted are shown - a limitation in Windows since Windows 95! (And still the case today in Windows 10). If you are competing with Google Drive for instance and both your Icon Overlays are in the top 15 you need to return a lower priority number which you do in SharpShell by overriding GetPriority(). If you both return the same priority perhaps it is the later as sorted that is then shown? Would have to test..

Using _ as others have suggested is not the way to go, it sorts after space.

What you want to do - specify the name programmatically as opposed to editing the registry manually is not provided by SharpShell - I have the same problem so am going to try add an attirbute that does just that, will update this when I do.

markmnl
  • 11,116
  • 8
  • 73
  • 109
0

How about using

[RegistrationName("  Test")]

It works to me.

Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
yhc1209
  • 1
  • 1