I'm trying to write a program which waits for a specific app (matlab in my case) to launch and does stuff when the app launches.
I see that I had to write a windows service application and managed get this working. I can see the service in Service Manager and can start-stop it. But I don't know how can "listen" or understand if Matlab (or any other app.) is launched. I'm kinda newbie when it comes to Windows Programming. Can you help me in this?
bool is_program_running(constwchar_t *name){
//iterate over running processes looking for one with the specified name
}
int main(){
while (true){
if (!is_program_running(L"matlab.exe")){
Sleep(1000);
continue;
}
//do something with the process
}
}