Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/284.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# createprocess中的Process.arguments?_C#_Createprocess - Fatal编程技术网

C# createprocess中的Process.arguments?

C# createprocess中的Process.arguments?,c#,createprocess,C#,Createprocess,以下操作在过程中效果良好。开始情况 private string Path() { RegistryKey Key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wizet\\"); RegistryKey Location = Key.OpenSubKey("MapleStory"); return Location.GetValue("ExecPath").T

以下操作在过程中效果良好。开始情况

private string Path()
        {
            RegistryKey Key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wizet\\");
            RegistryKey Location = Key.OpenSubKey("MapleStory");
            return Location.GetValue("ExecPath").ToString();
        }

public bool Launch()
        {
            maplestory = new ProcessStartInfo();
            maplestory.FileName = Path() + @"\MapleStory.exe";
            maplestory.Arguments = "WebStart";

            MapleStory = Process.Start(maplestory);
}
如果我使用CreateProcess,我现在将把“.Arguments”放在哪里?我将把CREATE\u也放在哪里

CreateProcess(AppName, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi);

在第二个参数中,可以放置命令行选项。在第六个选项中,你可以设置创建选项,比如创建挂起

CreateProcess(AppName,“WebStart”、IntPtr.Zero、IntPtr.Zero、false、CREATE\u挂起、IntPtr.Zero、null、ref si、out pi)

有关更多信息,请参阅

CreateProcess(AppName, "WebStart", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi);
public struct PROCESS_INFORMATION
{
    public IntPtr hProcess;
    public IntPtr hThread;
    public uint dwProcessId;
    public uint dwThreadId;
}

public struct STARTUPINFO
{
    public uint cb;
    public string lpReserved;
    public string lpDesktop;
    public string lpTitle;
    public uint dwX;
    public uint dwY;
    public uint dwXSize;
    public uint dwYSize;
    public uint dwXCountChars;
    public uint dwYCountChars;
    public uint dwFillAttribute;
    public uint dwFlags;
    public short wShowWindow;
    public short cbReserved2;
    public IntPtr lpReserved2;
    public IntPtr hStdInput;
    public IntPtr hStdOutput;
    public IntPtr hStdError;
}

public struct SECURITY_ATTRIBUTES
{
    public int length;
    public IntPtr lpSecurityDescriptor;
    public bool bInheritHandle;
}

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace CreateProcess
{
    public static void Main()
    {
        PROCESS_INFORMATION pi = new PROCESS_INFORMATION();
        STARTUPINFO si = new STARTUPINFO();

        CreateProcess("MapleStory.exe", "WebStart", IntPtr.Zero, IntPtr.Zero, false, 0, IntPtr.Zero, null, ref si, out pi);
    }

    [DllImport("Kernel32.dll")]
    private static extern bool CreateProcess(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, ref STARTUPINFO lpStartupInfo,out PROCESS_INFORMATION lpProcessInformation);
}