private void KillExcelProceed()
  {
   int ProceedingCount = 0;
   System.Diagnostics.Process[] ExcelProcesses;
   ExcelProcesses = System.Diagnostics.Process.GetProcessesByName("EXCEL");

   foreach(System.Diagnostics.Process IsProcedding in ExcelProcesses)
   {
    if(IsProcedding.ProcessName=="EXCEL")
    {
     ProceedingCount += 1;
    }
   }
   if(ProceedingCount > 0)
   {
    DialogResult result;
    result=MessageBox.Show("发现系统中有Excel进程,要关闭所有Excel进程吗?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
   
    if(result==DialogResult.Yes)
    {
     foreach(System.Diagnostics.Process myProcess in ExcelProcesses)
     {
      myProcess.Kill();

     }
    }
   }

  }

相关文章:

  • 2021-06-24
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-02-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-16
  • 2021-12-01
  • 2022-02-08
  • 2022-12-23
  • 2022-01-19
相关资源
相似解决方案