1

Possible Duplicate:
Windows shell extension with C#

Like when you right click on a file in windows and a list of options comes up, stuff like open, copy, delete, etc. How do you add another option? Also, similar and probably the same concept, how do you do the same thing for when you right click the desktop or a folder? All help is appreciated, thanks.

Community
  • 1
  • 1

3 Answers3

2

You are looking for Shell Extensions. See http://chestermr.blogspot.com/2007/03/shell-extension-context-menu.html

or http://www.codeproject.com/KB/cs/dateparser.aspx

L.B
  • 114,136
  • 19
  • 178
  • 224
0

HKCR[file type or extension]\shell[name of command]\command

set the default key to a REG_EXPAND_SZ type and the value to the path of the program to open it with.

MS Word example:

HKEY_CLASSES_ROOT\docxfile\shell\open\command = "%ProgramFiles%\Windows NT\Accessories\WORDPAD.EXE" "%1"

the "Folder" key under HKCR is where you place commands for directories.

Sam Axe
  • 33,313
  • 9
  • 55
  • 89
0

It's not a good idea to create shell extensions in managed languages like C#. There are lots of reasons, but the biggest is that you can't control what version of the .NET framework gets loaded in the shell if multiple extensions are present.

By that, i mean if a user loads an extension that uses .net 2, and then you try to load one that uses .net 4, then there are problems because only one version of .NET can be loaded into a process.

See Raymond Chen's article here: http://blogs.msdn.com/b/oldnewthing/archive/2006/12/18/1317290.aspx

Erik Funkenbusch
  • 92,674
  • 28
  • 195
  • 291