Qt 检测检测是否存在并关闭进程
时间:2021-05-08 16:21:34
收藏:0
阅读:17
bool bIsExist = false; // 进程是否存在 QProcess process; process.start("tasklist.exe"); if (process.waitForFinished()) { QByteArray result = process.readAll(); QString exe = QString(result); if (exe.contains(strProcessName)) { bIsExist = true; // 找到了 } } process.close(); //结束进程 QStringList list; list << "/im" << strProcessName << "/f"; QProcess::execute(QLatin1String("taskkill"), list);
原文:https://www.cnblogs.com/tingtaishou/p/14744400.html
评论(0)