Add item to context menu

I would like to add an item to the context menu (e.g. TortoiseSVN, or 7zip, etc.)

I'm not sure how to do this or what exactly is called.

It would be preferable if this option was only available during my program.

Use case:

The user will select text on a web page (or a document with text or anything on their computer) and right click, select my item from the menu and execute my DoSomething (string myString).

EDIT:

I am currently developing XP, but I would like this program to work on Vista / Win7

+1


a source to share


4 answers


It depends on where you want the context menu items and for what purpose. Most of the answers so far pertain to context menus in explorer, but if you want to change the context menu within a program as your question speaks, it becomes much more difficult and / or impossible.



However, it is very convenient to add context menu items to file types in explorer without shell extensions, it is possible to manage the registry or third party utilities or from COM as others have said.

+1


a source


You need to use (Explorer) shell extensions. They are programmed with COM.

COM is required for unsupervised programming. So, if you want to know a lot about how Windows works, get the book and study it. There will be an example of adding items to a menu.



There may be .Net wrappers for what you want, but I don't know about them yet.

+2


a source


I believe this can be achieved by adding / removing entries in the system registry.

A practical example can be found here: http://www.jfitz.com/tips/rclick_custom.html

+1


a source


They are called Shell Extensions .

Well, sorta - shell extensions can do a lot more than just change context menus, but if you want to do something non-trivial with menus, then you'll want to write a shell extension.

+1


a source







All Articles