Reputation: 101
Until now I was using this function to kill a process. But what if I have three processes of the same name and only one of them is the one that I want to kill? If I will do this: KillTask('csrss.exe') then it will kill the system process. I have the path of my process, how can I use this information to kill it?
Upvotes: 3
Views: 3875
Reputation: 6111
Iterate over processes and check the path for each of them, then use the answer from this SO question (use GetModuleFileNameEx):
get the full path from a PID using delphi
If you launched the process then remember the PID or Handle and kill the specific one.
Upvotes: 4