• 2012-2-7列举及终止进程


    System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcessesByName("MSACCESS");

                while (ps.Length > 0)          {                 ps[0].Kill();

                     System.Threading.Thread.Sleep(20);

                     ps = System.Diagnostics.Process.GetProcessesByName("MSACCESS");

                 } /////////////             string tempName = "";

                 int begpos;

                 int endpos;

                 foreach (System.Diagnostics.Process thisProc in System.Diagnostics.Process.GetProcesses())             {                 tempName = thisProc.ToString();

                     begpos = tempName.IndexOf("(") + 1;

                     endpos = tempName.IndexOf(")");

                     tempName = tempName.Substring(begpos, endpos - begpos);

                    if (tempName == "MSACCESS")

                     {

                         thisProc.Kill();//当发送关闭窗口命令无效时强行结束进程

                         while (!thisProc.HasExited) System.Threading.Thread.Sleep(10);

                         System.Threading.Thread.Sleep(100);

                     }

                 }

  • 相关阅读:
    Luogu P1131 时态同步
    Codeforces Round #507 B. Shashlik Cooking
    Codeforces Round #507 A. Palindrome Dance
    Luogu P3818 小A和uim之dark♂逃离 Ⅱ
    Luogu P1373 小a和uim之dark♂逃离 Ⅰ
    Luogu P4822 [BJWC2012]冻结
    Luogu P2575 高手过招(博弈论)
    Luogu P1074靶形数独
    Luogu P2323「皇后游戏」
    GodFly的寻宝之旅·状压DP
  • 原文地址:https://www.cnblogs.com/mol1995/p/5965082.html
Copyright © 2020-2023  润新知