views:

25

answers:

2

Hi , I'm trying to implement "Copy as path" option in windows context menu ,which copies current file or folder path to clip board instead of installing a software for this , i would like to implement it my self. Any suggestions?

A: 

You can add a link to the context menu by fiddling with the File Types dialog, or using the registry. In the registry, the path is HKEY_CLASSES_ROOT\*\shell. Add a key under that named "Copy as path", and a key under that named "command". Change command's default string value to "c:\your-program.exe %1", and when the user selects "Copy as path" it will run your executable with that path as the argument. Now your executable just needs to write the path passed in to it to the clipboard

Michael Mrozek
Yes , but i would like to know if there is any already made windows program or DLL do this operation for me , instead writing new say Java program ? probably how normally a windows copy operation is working
srinannapa
@sri Using an "already made windows program" is the opposite of "instead of installing a software for this , i would like to implement it my self" -- which do you want? If you're just looking for a program that writes to the clipboard, this isn't really the site for that
Michael Mrozek
@Michael Mrozek I'm not looking for any program or software , when i say "already made windows program" , i mean , if there is any windows feature provided by microsoft is available.
srinannapa
A: 

You will need to write your own shell namespace extension. A sample on how to do that using C# is available here. There is many examples on how to do that in C++ on web too.

The official documentation on the topic is available at MSDN. A specific article on this topic is Creating Context Menu Handlers.

Carlos Loth