一个c#的程序问题
为什么调用CloseMainWindow()关不掉进程?哪位大哥能帮我解决一下。
using System;
using System.Diagnostics;
using System.Threading;
namespace Process_Sample
{
class MyProcessClass
{
public static void Main()
{
Process myProcess;
myProcess = Process.Start("Notepad.exe");
myProcess.CloseMainWindow();
myProcess.Close();
}
}
}
------解决方案-------------------- Process myProcess;
myProcess = Process.Start("Notepad.exe");
myProcess.WaitForInputIdle();
myProcess.CloseMainWindow();
myProcess.Close();
------解决方案--------------------using System;
using System.Diagnostics;
using System.Threading;
namespace Process_Sample
{
class MyProcessClass
{
public static void Main()
{
Process myProcess;
myProcess = Process.Start("Notepad.exe");
myProcess.CloseMainWindow();
myProcess.Kill();
}
}
}
------解决方案--------------------http://msdn2.microsoft.com/zh-cn/library/8d7363e2(VS.80).aspx