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

相关文章:

  • 2021-12-15
  • 2022-12-23
  • 2021-11-22
  • 2022-02-02
  • 2022-12-23
  • 2021-06-05
猜你喜欢
  • 2021-11-02
  • 2021-10-04
  • 2021-12-24
  • 2021-09-28
  • 2021-06-28
  • 2022-01-30
相关资源
相似解决方案