简体   繁体   English

在C#中执行我文件的应用程序

[英]execute my file’s Application in C#

My application creates files with a ".mhm" extension. 我的应用程序创建带有“ .mhm”扩展名的文件。

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? 如何在C#2008中读取Main()方法的args参数?

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. 我的应用程序创建的文件扩展名为.MHM。 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." 我希望我的应用程序与此文件扩展名相关联,以便在执行MHM文件时,我的应用程序也是如此,文件路径作为我的应用程序主要方法的参数。”

That's what I understood. 这就是我的理解。

Grzenio has the right idea - Grzenio有正确的主意-

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). 但是要将您的应用程序推入Shell需要额外的研究,您必须考虑将应用程序集成到Shell中(使用注册表)。

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. 编辑:感谢克里斯(Chris)的问题编辑,试图在这里看到更多的东西...也许参数解决方案是所有所需的OP。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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