ホーム‎ > ‎私の開発環境‎ > ‎

Right Click File Folder Question

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/a423ee25-25eb-4595-839d-db8e58ed8126

 

2. Use the registry to control the shell context menu as kaymaf already showed. But I want to add some points. His codes only add keys in the HKCR\Folder\Shell. So the item will only appear when we right click a folder, not a file. As per your demand, I think we need to add keys into the HKCR\AllFilesystemObjects\Shell.

So the following is detailed steps,

1. Open your regedit
2. Navigate to HKCR\AllFilesystemObjects
3. Create a new Key named shell if it does not exist.
4. Under the shell, create a new key whose name will appear as the menu item.
5. Under that key created in step4, create a new key named command
6. Set created command key's default value to {yourapplicationfullpath -d "%1"}

For example, I use notepad in my side to have a test, so I will have the following key,
HKCR\AllFilesystemObjects\shell\Open in notepad\command (its default value is notepad -d "%1" )

Then when I right click a file in my explorer, I can find the option Open in notepad. If I click that option and the selected file is .txt, it will be opened in notepad.

In you application, to recieve the parameter, you just need to write a parameterized Main method or call the System.Environment.GetCommandLineArgs()

Comments