Programmatically adding item to explorers 'folder' context menu

J

john

I would like to programmatically (from VB.NET or C#), manage items in
the windows explorer 'folder' context menu (right click menu). I need
an entry to be able to pass the folder path to my application. If I
can configure this using the .NET framework then that would be ideal,
using Win32 a close second. Modifying the registry would be ok but not
sure how safe this would be on future versions of windows. Any help
much appreciated.
 
G

Gabriele G. Ponti

Add an entry in the registry under HKEY_CLASSES_ROOT\Directory\shell, if you
look at what you already have there you should understand how to do it.
Basically you first add a key, and as (Default) value you set the text for
the menu, then under this key you create a new key called command, and set
the (Default) value to your program. Use "%1" as placeholder for the
argument line (the directory the user selected).
 
J

john

Comparing this registry location with the contents of the context menu
when I right click on a windows explorer folder,
HKEY_CLASSES_ROOT\Directory\shell only contains a small subset of the
contents of the explorer menu. For example, Winzip is not listed here
but does have what looks like a classid entry under shellex in various
locations in the registry (and probably has further entires
elsewhere).

Is there not some api that can be used to set this up ?
 
G

Gabriele G. Ponti

WinZip is a shell extension. It's more complex to code than my suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top