c++ - Open a programm and know if it is open -


i want write program in c++ can open .exe program , want know when it's close user. know can open program code:

system ("start c:\\aaa.exe"); 

however don't know how can check if program closed.

calling system ("c:\aaa.exe"); can block until process aaa.exe finished.

if not acceptable, can call system ("c:\aaa.exe"); in separate thread, , check finished or not.

#include <thread>   void threadroutine() {     ::system("c:\aaa.exe"); }  int main() {     std::thread systemcall(threadroutine);     //do work here     systemcall.join();     //you sure aaa.exe finished     return 0; } 

Comments