C#关闭IE相应的窗口 .

window.close();

 

System.Diagnostics.Process[]   myProcesses;  
  myProcesses   =   System.Diagnostics.Process.GetProcessesByName("IEXPLORE");  
  foreach   (System.Diagnostics.Process   instance   in   myProcesses)  
  {  
  instance.CloseMainWindow();  
  }

 

 

 

 instance.kill();  

 

Process[]   pros   =   System.Diagnostics.Process.GetProcessesByName("IEXPLORE");  
  foreach(Process   p   in   pros)  
  {  
  if(p.MainWindowTitle.Equals("YourTitleSetting"))  
  p.Kill();  
  }  

 

 

 

 

 

  1. //关闭所有的IE    
  2.            System.Diagnostics.Process[] myProcesses;  
  3.             myProcesses = System.Diagnostics.Process.GetProcessesByName("IEXPLORE");  
  4.             foreach (System.Diagnostics.Process instance in myProcesses)  
  5.             {  
  6.                 instance.CloseMainWindow();  
  7.             }  
  8.             instance.kill();  
  9. //关闭标题为你要求的IE   
  10.             Process[] pros = System.Diagnostics.Process.GetProcessesByName("IEXPLORE");  
  11.             foreach (Process p in pros)  
  12.             {  
  13.                 if (p.MainWindowTitle.Equals("YourTitleSetting"))  
  14.                     p.Kill();  
  15.             }    

posted on 2012-05-09 22:34  HOT SUMMER  阅读(3463)  评论(0编辑  收藏  举报

导航