Wednesday, October 6, 2010

Terminate all the instances of a Process through code

Tip -  How to Terminate all the instances of a Process through code

Details -  By the below shared lines of codes one can terminate all the instances of a process. CreateToolhelp32Snapshot API is used to take the snapshot of all the processes and threads in the system. The process which is to be terminated is identified from the snapshot using the Process Name. Then the process object is accessed using OpenProcess API and terminated using TerminateProcess(). The CreateToolhelp32Snapshot API not only takes a snapshot of the processes, but also the heaps, modules, and threads used by the processes.



Posted by - Sobhita Mercy E

No comments:

Post a Comment