简体   繁体   中英

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?

If I understand your question correctly you just use:

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

"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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM