QString strProcessName = "QQ.exe";
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); //程序需以管理员权限运行