[After OP's clarification]
Now I see: the problem is how to work with the Windows Shell.
First of all, here is how it works: Explorer is just one of the applications using Windows Shell. It could be any other application (alternative or 3rd-party file manager, or something else, correctly using the Shell API). What it does is this: it executes your application with some command-line parameters. By default, for format is "yourApplication.exe some_file_name". To start with, let's assume you simply created the application and then used "Open with" context menu item, and then selected your application having the file name selected.
Then your application is started, and then the file name is passed to it in a command line. You can get its name when it is passed to your
Main
function (entry point) or using the property
System.Environment.CommandLine
. Please see:
http://en.wikipedia.org/wiki/Main_function#C.23[
^],
http://msdn.microsoft.com/en-us/library/system.environment.commandline.aspx[
^].
Now, if you also
register your file type to be used with your application by default, you can get to additional features:
- your application can be loaded by default on click of the data file;
- your application can introduce more complex command line with any number of additional features, as the command line format is also registered in the system Registry.
This topic is more advanced. Most usually, registration of file types is used when you also deploy your application with the setup (based on MSI and Windows Installer API). The setup you produce should take care about this registration. I think the topic is too big to be explained in a single Quick Answer. You should choose some installation framework and learn it.
If you want to make your application self-registering the file type(s), please see, for example:
http://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c-sharp[
^].
If your command-line parsing needs to be a bit more advances or even very complex, I could suggest using my library, which is also very easy to use. Please see my CodeProject article:
Enumeration-based Command Line Utility[
^].
In this article, I also reference yet another, more complex solution; please see.
Good luck,
—SA