adding my program to right-click menu

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


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].