关联的文件类型不回文件位置

问题描述 投票:2回答:1

当我在我的文件,点击它会打开该程序,但它不通过ARGS我已经设置在发布设置,我的关联文件设置。所以我不能做的文件进行任何操作。我认为这是已经设置正确我添加了一个字符串参数的主,但其一直空白。

public class Program
{
    [STAThread]
    static void Main(string[] args)
    {
        //string[] openvalue = new string[1];
        //thingoo = new string[0];
        //thingoo[0] = "hi therer hows it...";

        try
        {
            if (args[0] != null)
            {
                MessageBox.Show(args[0]);
            }
        }
        catch(Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }

        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new MainForm(args));
    }
}

ARGS [0]应该是该文件的位置,但它的空白

c#
1个回答
0
投票

因此,对于一些未知的原因给人类,这就是答案......

串[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;

这是串0这个数组中,如果有人可以指向文档,这将是巨大的,我不知道如何与其相关的,为什么它的存在,但经过约20小时的寻找在互联网上随机的文章中透露这个.. 。

© www.soinside.com 2019 - 2024. All rights reserved.