mohammad reza
mohammad reza

Reputation: 3432

execute my file’s Application in C#

My application creates files with a ".mhm" extension.

I'd like for my application to open and process these files when I double-click them. Current behavior is that when I double-click the file, my application opens but does not process the file.

How can I read the args parameter of Main() method in C# 2008?

Upvotes: 0

Views: 267

Answers (2)

Daniel May
Daniel May

Reputation: 8226

"Hi

My Application creates files with the .MHM file extension. I would like my application to be associated with this file extension so that when a MHM file is executed, my application is too, with the file path as the arguments for the main method of my application."

That's what I understood.

Grzenio has the right idea -

public void static Main(string args[])
{ 
...
}

but to push your application into the shell would take extra research, you'd have to look into integrating your application into the Shell (using the registry).

See here: script-to-associate-an-extension-to-a-program

EDIT: Thanks for the edit of the question Chris, trying to see things a bit wider here... Perhaps the arguments solution was all the OP needed.

Upvotes: 2

Grzenio
Grzenio

Reputation: 36639

If I understand your question correctly you just use:

public void static Main(string args[])
{
...
}

Upvotes: 2

Related Questions