12

with right click menu, I mean this: I dont really know what its called, but i hope its right click menu.

When I google for queries like title of this question, i get nothing. some tutorials that shows how can i add an .exe to that list etc. but I'm looking for some tutorial that will teach me how to handle that data, what that right click menu will return me, etc. But sadly, I found nothing. So here I am, asking...

How can I add my program to that list, and when I do what it returns to me, are there any tutorial for this on the internet ?

user
  • 5,335
  • 7
  • 47
  • 63
Foresp
  • 425
  • 1
  • 7
  • 15
  • Maybe you're looking for this: http://msdn.microsoft.com/en-us/library/aa753589(v=vs.85).aspx And by the way, the formal name for it is "context menu". – Seth Carnegie May 30 '11 at 18:26
  • The "right-click menu" is often called a "context menu" because the options that are available often change with the context (try right-clicking in a web browser, on your desktop, and in a word-processor to see the different menus that different contexts provide). – FrustratedWithFormsDesigner May 30 '11 at 18:27
  • I see your question is quite ambiguous, do you mean A shell context menu entry or a context menu inside your app?, 'cause you're showing us about the first one – james_bond May 30 '11 at 18:32

2 Answers2

12

You would add some keys to the registry to have your program in that list. You can find more about it here: http://www.howtogeek.com/howto/windows-vista/add-open-with-notepad-to-the-context-menu-for-all-files/

In the example they use Notepad.exe %1 that will basicly do the same as calling Notepad.exe c:\myFile.txt from the run window.

You can read the parameter in the main(string[] args) method. It will pass it as contents of the args parameter. You can also get that value anywhere else in your application using the Environment.GetCommandLineArgs() method.

Please note that you should use Notepad.exe "%1" if the file you right-click on has spaces in its fullname, otherwise the fullname will be split into the args[i].

romellem
  • 5,792
  • 1
  • 32
  • 64
Jan-Peter Vos
  • 3,157
  • 1
  • 18
  • 21
2

What you want is a contextmenu. Google "contextmenu" C#. than you should find, what you want to find. For example: http://msdn.microsoft.com/en-us/library/aa984254(v=vs.71).aspx

muma
  • 21
  • 1