none
vb2010.net怎么调用外部进程 RRS feed

答案

  • 您好,

    请问您指的是在程序中打开一个进程吗?如果是的话,可以用一下代码实现:

    Process myProcess = new Process();
    
                try
                {
                    myProcess.StartInfo.UseShellExecute = false;
                    // You can start any process, HelloWorld is a do-nothing example.
                    myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
                    myProcess.StartInfo.CreateNoWindow = true;
                    myProcess.Start();
                    // This code assumes the process you are starting will terminate itself. 
                    // Given that is is started without a window so you cannot terminate it 
                    // on the desktop, it must terminate itself or you can do it programmatically
                    // from this application using the Kill method.
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
    


    具体内容,请参阅:

    http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    • 已标记为答案 Honny_yeyh 2012年1月9日 11:43
    2012年1月9日 9:24