首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

一个c#的程序有关问题

2012-02-10 
一个c#的程序问题为什么调用CloseMainWindow()关不掉进程?哪位大哥能帮我解决一下。using Systemusing Sys

一个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

热点排行