Click here to Skip to main content
15,886,823 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Screen
I work on app to copy and paste filenames. I already have a working context menu with little subapps (written in c#), but I would like to that paste options will be visible only if clipboard contains some text. How to do it? Is it possible by add something to registry?

What I have tried:

I have no idea. Keys in Windows registry below.
Registry key context menu:
[HKEY_CLASSES_ROOT\*\shell\CopyPasteFileName]
"SubCommands"="cfn;cfp;pfn;pfnne"
"icon"="C:\\Users\\KN\\Desktop\\files\\icon.ico"
"Position"="Bottom"

Paste filename keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\pfn]
@="Paste Filename"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\pfn\command]
@="C:\\Program Files\\CopyPasteFileName\\pfn.exe \"%1\""

Other menu items have similar keys
Posted
Updated 25-Jul-18 5:34am

There's nothing you can put into the registry that's going to do the whole "If there's something on the clipboard" thing. You're going to have to provide actual code for that and modify the context menu on-the-fly.

The only way to do that is to write a shell extension. This is FAR from a trivial piece of code to write. Thankfully, there's a couple series of articles here on CP that covers this, like .NET Shell Extensions - Shell Context Menus[^] and Explorer Shell Extensions in .NET (Revised)[^].
 
Share this answer
 
 
Share this answer
 
Comments
Dave Kreskowiak 25-Jul-18 11:28am    
I think he's just poking registry entries in to get the shell to add his apps to the context menu.

To do what I think he wants, he's going to have to write a shell extension.

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