I want my C++ program to scan for processes and when a certain file.exe is running, I want my program to do something (irrelevant here). Could you help me with this task?
I found something on the internet. Is this ok ?
CreateMutex(NULL, FALSE, NAMEofTHEprocess_exe);
if (GetLastError() == ERROR_ALREADY_EXISTS)return 0;
Can I use it in my program? I dont know what the Mutex is.
Here’s a basic enumeration of running processes in Windows:
You can use the final name look-up with
getProcessNameByIDto make a decision. Here’s the code forgetProcessPathNameByID: