I think I'm right in saying that, when you use Open With, the OS calls the program in question with a command line argument equal to the full path of the file.
So, I'd try placing the following code in your Form1_Load eventhandler:
private void Form1_Load(object sender, EventArgs e) { string[] args = Environment.GetCommandLineArgs(); int len = args.Length; if (len > 0) { textBox1.Text = System.IO.File.ReadAllText(args[len - 1]); } }
You'll also need to add your program to the Open With list for the file extension in question. To do that, I'd check out this link which also shows how to edit the registry to remove it.
1 answers
I think I'm right in saying that, when you use Open With, the OS calls the program in question with a command line argument equal to the full path of the file.
So, I'd try placing the following code in your Form1_Load eventhandler:
You'll also need to add your program to the Open With list for the file extension in question. To do that, I'd check out this link which also shows how to edit the registry to remove it.
answered one year ago by:
17279
153
thank you