How to kill a process by it’s PID on Windows

I don’t want to sound mean but, God, MSDN API sucks =P. Not because it doesn’t tell you the stuff you need to know but because it requires alot of imagination from you to understand it.

For example, I was looking for a way to kill a process using it’s process id ( PID) however it turn that when you are programming for WIN32 you need to use HANDLE’s for everything so if you’d like to have a process that creates process and then kill them you’d have to store and manage every handle.

Now I don’t lik handling Handle and pointers I like to keep it simple using integers, an array of integers to me is way easier to use than an arrat of handles since pasing pointers and casting and etc.. is not my passion on C++. Thus I found a way to kill processes by their PID using this nice simple function:


Hope this works for you

Cheers

VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)

One thought on “How to kill a process by it’s PID on Windows

  1. Thank you very much, because this snippet solved a very important problem of mine.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *