Home > Back-end >  How to end the process
How to end the process

Time:11-24

C language, how to end process, Internet use TerminateProcess, a lot of people say I need according to the process name is over, want to ask how to implement this?

Some examples are find process of PID, the first to use OpenProcess handles, but I don't have the PID, only the process name and PID is not fixed, it what should I do?

CodePudding user response:

Windows generally offer apis such as PROCESSENTRY32 pe32
Refer to the following link
https://wap.zol.com.cn/ask/details_10408655_2159984_3.html
Or
https://blog.csdn.net/lunweiwangxi3/article/details/97271272
Linux is often a city management files

Really not line, you call system commands to get
Such as Windows system can call the tasklist | findstr searches process name
Linux system can call ps - ef | grep process name

CodePudding user response:

Have according to the process name, process Id for method

CodePudding user response:

reference 1st floor qybao response:
Windows offer apis, such as general PROCESSENTRY32 pe32
Refer to the following link
https://wap.zol.com.cn/ask/details_10408655_2159984_3.html
Or
https://blog.csdn.net/lunweiwangxi3/article/details/97271272
Linux is often a city management files

Really not line, you call system commands to get
Such as Windows system can call the tasklist | findstr searches process name
Linux system can call ps - ef | grep process name


Thank you, I have a try later
  • Related