Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 运行非托管资源_C#_Embedded Resource - Fatal编程技术网

C# 运行非托管资源

C# 运行非托管资源,c#,embedded-resource,C#,Embedded Resource,如何从资源中运行非.NET exe? 我想在进程中执行嵌入式资源exe,但不知道如何执行,也不知道是否可能。 在我注意到反射只对托管资源起作用之前,我尝试过反射,所以,可以运行非托管资源而不提取它吗?我将非常感谢与此相关的任何类型的信息。 提前感谢。使用 嵌入的资源应复制到Output文件夹,并使用相对路径 using System; using System.Diagnostics; using System.ComponentModel; namespace MyProcessSa

如何从资源中运行非.NET exe? 我想在进程中执行嵌入式资源exe,但不知道如何执行,也不知道是否可能。 在我注意到反射只对托管资源起作用之前,我尝试过反射,所以,可以运行非托管资源而不提取它吗?我将非常感谢与此相关的任何类型的信息。 提前感谢。

使用

嵌入的资源应复制到Output文件夹,并使用相对路径

    using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    class MyProcess
    {
        // Opens the Internet Explorer application. 
        void OpenApplication(string myFavoritesPath)
        {
            // Start Internet Explorer. Defaults to the home page.
            Process.Start("IExplore.exe");

            // Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath);
        }

        // Opens urls and .html documents using Internet Explorer. 
        void OpenWithArguments()
        {
            // url's are not considered documents. They can only be opened 
            // by passing them as arguments.
            Process.Start("IExplore.exe", "www.northwindtraders.com");

            // Start a Web page using a browser associated with .html and .asp files.
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.htm");
            Process.Start("IExplore.exe", "C:\\myPath\\myFile.asp");
        }

        // Uses the ProcessStartInfo class to start new processes, 
        // both in a minimized mode. 
        void OpenWithStartInfo()
        {
            ProcessStartInfo startInfo = new ProcessStartInfo("IExplore.exe");
            startInfo.WindowStyle = ProcessWindowStyle.Minimized;

            Process.Start(startInfo);

            startInfo.Arguments = "www.northwindtraders.com";

            Process.Start(startInfo);
        }

        static void Main()
        {
            // Get the path that stores favorite links. 
            string myFavoritesPath =
                Environment.GetFolderPath(Environment.SpecialFolder.Favorites);

            MyProcess myProcess = new MyProcess();

            myProcess.OpenApplication(myFavoritesPath);
            myProcess.OpenWithArguments();
            myProcess.OpenWithStartInfo();
        }
    }
}