How to check if a program is running by its name with Qt (C++)

前端 未结 3 1906
情深已故
情深已故 2021-02-04 13:37

How to check if a program is running, by its name, with Qt (C++).

Will QProcess::pid do the job? I don\'t know how to use it. Please suggest.

3条回答
  •  迷失自我
    2021-02-04 13:39

     //How to Run App
     bool ok = QProcess::startDetached("C:\\TTEC\\CozxyLogger\\CozxyLogger.exe");
     qDebug() <<  "Run = " << ok;
    
    
     //How to Kill App
     system("taskkill /im CozxyLogger.exe /f");
     qDebug() << "Close";
    

    enter image description here

提交回复
热议问题