OK Bill, calm down.
I'm assuming from your previous post that you figured out how to
associate a file type in Windows, so now you can double-click a file and
it runs your application, yes?
What's happening, is that Windows is effectively running your
application as if you had typed:
C:\>YourApp.exe foo.rtf
....on the command line. It's telling you the name of the file that was
clicked by passing it to you as a command line argument.
What you need next, is the code to figure out what command line
arguments have been passed to you. That's what I gave you in my previous
post. When your program's main() function is called, it is passed a
string array containing whatever arguments were on the command line when
your executable was invoked:
static void Main(string[] args)
That's what 'args' is. Next we check how many arguments there were, and
if there was just one, we test to see if it's a file that exists on the
file system somewhere:
if (args.Length == 1 && System.IO.File.Exists(args[0]))
args[0] in this case would be the string "foo.rtf".
Now we know what file was clicked to launch our program, and from here
we can do whatever we want with that file. I'm assuming we have a Form
called MainWindow that represents our application (substitute your own
appropriate class name here, Form1 perhaps), and so I pass the filename
to the constructor of MainWindow when I start the app:
Application.Run(new MainWindow(args[0]));
The rest was left up to your imagination, which I had assumed would be
able to recognize that you could create a constructor like:
public MainWindow(string filename)
{
// here's where you would do something with the
// filename, like open the file and read the
// contents into your control
}
I can't walk you through the rest of the details right now, but perhaps
someone else would like to take a turn.
-Jason