Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i want to add my program to windows context menu and i don't have problem to do it but my problem is if i want to do it for picture i don't know what should i write replace "Folder" in this code
C#
private const string MenuName = "Folder\\shell\\NewMenuOption";
public const string Command = "Folder\\shell\\NewMenuOption\\command";

Best Regrads
Posted
Comments
DamithSL 15-Nov-14 10:10am    
"do it for picture!" what exactly you want to do?
Avenger1 15-Nov-14 10:47am    
i tried picture, image, img, photo but no one made it for right click

1 solution

You should start learning there is a Registry built right into the Windows. Which controls the overall behaviour of the applications and the system processes and you can edit them as per your requirements.

You need to edit the "HKEY_CLASSES_ROOT\Directory\Background\shell" section for your system (or the system your application would execute at). Once inside this location, follow the steps


  1. Create a new Key in the shell; Name it as you want it to appear in the context menu.
  2. Inside that Key, Add a new key, name it "command".
  3. Edit it, and give it the value of your application's location, the executable's location.


This is the manual process, to do this in the C#, you will have to edit the Registry using Visual C#. Refer to the MSDN RegistryKey Class I've included in the last paragraph. It would give you information about the methods that can be used to edit the Registry from your application.

For more on this, please go to, this blog[^] and to learn working with the Registry in .NET using Visual C#, go to MSDN[^].
 
Share this answer
 
Comments
Avenger1 15-Nov-14 10:57am    
i know how to work with registry
i want when i right click in in image it show my program but in the code the up you see the name is folder and it just work for folder
Afzaal Ahmad Zeeshan 15-Nov-14 11:06am    
That was not the code meant perfectly and ready to be ported for you. You can just edit it, to make sure that the image is being provided with this context.
Avenger1 15-Nov-14 11:12am    
as i said i tried what i knew but it didn't answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900