Related: How can I add a program to the context menu of all files?
I've created my custom context menu item, and it seems to work on all file types - even through shortcut links. (Selecting my custom option performs the operation on the shortcut target, not the .lnk file.) Now, I'd like to create an icon to make it stand out. My antivirus program and Notepad++ seem to have been able to do this, so I know it's possible. The only question is, how?
-
1For Windows 10, stackoverflow.com/questions/20449316/… and stackoverflow.com/a/27090678/470749 were helpful for me.Ryan– Ryan2020年06月23日 01:22:42 +00:00Commented Jun 23, 2020 at 1:22
2 Answers 2
Open regedit.exe and find the key that you created for the custom menu item.
Now create a new String value in it and name it Icon. Double-click it and enter the path to your custom icon file:
c:\folder\icon.ico
Optionally you could use the Windows shell32.dll file like in my example: Registry
The result:
Icon in custom context menu
Just an additional note - looks like this method works on Windows 7 (and probably Vista) but the icon did not appear when I tested on Windows XP.
-
Thanks for the answer, and testing on XP. I'll have to give this a shot later today. Also, I've noticed your method seems to differ a bit from the answer to my previous question. (See link in this question.) In the previous answer, the text for the context menu item is stored in the key name. In yours, it's stored in a string value within the key. Is there any practical reason for the difference?Iszi– Iszi2012年02月21日 13:27:24 +00:00Commented Feb 21, 2012 at 13:27
-
@Iszi - not sure if there's any real difference. I just happened to find such an exampleSiim K– Siim K2012年02月21日 18:59:04 +00:00Commented Feb 21, 2012 at 18:59
-
1It seems you're right about it not working on XP. I can't think of why it wouldn't, since my AV and Notepad++ still have icons. They seem to have their functions covered under
HKCR\*\shellex\ContextMenuHandlersthough, and I can't begin to decipher on my own how those keys work.Iszi– Iszi2012年02月21日 19:39:09 +00:00Commented Feb 21, 2012 at 19:39 -
Tested and works in Windows 7. I'll go ahead and post XP as another question.Iszi– Iszi2012年02月22日 03:33:36 +00:00Commented Feb 22, 2012 at 3:33
-
2@luochen1990 It is the index number - which icon from the .dll is used. Here is a table for shell32.dll with the icons and the corresponding indexes: help4windows.com/windows_7_shell32_dll.shtmlSiim K– Siim K2017年05月08日 21:26:54 +00:00Commented May 8, 2017 at 21:26
...And If you want, you can use the default/same icon that your program (exe file) already is using.
Simply use something like below as the content of your Icon string value that @Slim K pointed you to in his answer:
"C:\Path\to\YourProgram.exe",0
Sublime Text 3 doesn't use an icon for its context menu option. So I added an Icon string value with the content you see in screenshot.
-
what does the number '0' following the path means?luochen1990– luochen19902017年05月08日 12:48:52 +00:00Commented May 8, 2017 at 12:48
-
1@luochen1990 as mentioned in the accepted answer by Siim K, it is the index number of the icon in the DLL file. In this case, the number zero is the first icon in the DLL. You can read more about this numbering system hereChristian Sirolli– Christian Sirolli2017年11月06日 00:02:53 +00:00Commented Nov 6, 2017 at 0:02
You must log in to answer this question.
Explore related questions
See similar questions with these tags.