zoukankan      html  css  js  c++  java
  • QT 强制杀死进程

    bool KillProcess(QString ProcessName)

     bool result = false;
     QString str1;

     HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0) ; 
     PROCESSENTRY32 pInfo; 
     pInfo.dwSize = sizeof(pInfo);

     Process32First(hSnapShot, &pInfo);
     do 
     {
      str1 = (QString::fromUtf16(reinterpret_cast<const unsigned short *>(pInfo.szExeFile)));
      if (str1 == ProcessName) 
      {
       result = true;
       QString cmd;
       cmd = QString("taskkill /F /PID %1 /T").arg(pInfo.th32ProcessID);  

       system(cmd.toAscii());
      } 
     } while(Process32Next(hSnapShot, &pInfo) ); 
     return result;
    }

    http://blog.csdn.net/itjobtxq/article/details/8450449

  • 相关阅读:
    ConcurrentHashMap源码阅读
    java中Scanner类nextLine()和next()的区别和使用方法
    setuid
    lsattr
    设置umask
    touch
    od
    vi 搜索
    nl
    cat 参数
  • 原文地址:https://www.cnblogs.com/findumars/p/5574301.html
Copyright © 2011-2022 走看看