zoukankan      html  css  js  c++  java
  • 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);

                     }

                 }

  • 相关阅读:
    PyCharm小技巧
    How to install torcs package in Debian
    QT4.8.6静态编译
    Debian初识(选择最佳镜像发布站点加入source.list文件)
    Dev-C++ 小问题锦集
    ubuntu 12.04lts 安装mysql ,并通过QT连接
    win7下安装ubuntu14.04lts 双系统
    cmake打印变量值
    驾车常识:小轿车灯光
    汽车点火开关的功能介绍
  • 原文地址:https://www.cnblogs.com/mol1995/p/5965082.html
Copyright © 2011-2022 走看看