Using "Open With"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have developed a simple text editing program using Windows Forms. I want
to be able to right-click on a text file, choose "Open With" and select my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed? Should I
deal with them after capturing the Load event, or is there a different event?
Am I not even close?

Thank you for your time.

-Daniel
 
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc
 
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which event
to act on them.

WRH said:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc


I have developed a simple text editing program using Windows Forms. I want
to be able to right-click on a text file, choose "Open With" and select my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed? Should
I
deal with them after capturing the Load event, or is there a different
event?
Am I not even close?

Thank you for your time.

-Daniel
 
The path of the file selected in Windows Explorer's "Open With" is
passed as the first argument, ie arg[0]

In my case I act upon it just after Form InitializeComponent()


Daniel Miller said:
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which
event
to act on them.

WRH said:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

message

I have developed a simple text editing program using Windows Forms. I
want
to be able to right-click on a text file, choose "Open With" and select
my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed?
Should
I
deal with them after capturing the Load event, or is there a different
event?
Am I not even close?

Thank you for your time.

-Daniel
 
Okay, thanks. :)

WRH said:
The path of the file selected in Windows Explorer's "Open With" is
passed as the first argument, ie arg[0]

In my case I act upon it just after Form InitializeComponent()


Daniel Miller said:
Thank you for the response.

I know how to access the command line arguments, but I don't know which
arguments (if any) are sent . Additionally, I am not sure after which
event
to act on them.

WRH said:
Hello

You can access the command line parameters at the main entry point,eg...
static void Main(string [] args)

{

if(args.GetLength(0) >0)
{
string filearg = args[0]

etc

message


I have developed a simple text editing program using Windows Forms. I
want
to be able to right-click on a text file, choose "Open With" and select
my
program from the list to open the file, but I don't know how to get my
program to "accept" a file in such a way.

Is it using the command line? If so, what arguements are passed?
Should
I
deal with them after capturing the Load event, or is there a different
event?
Am I not even close?

Thank you for your time.

-Daniel
 
Back
Top