Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kill Active Threads/ProcessThreads - by id preferred.

Status
Not open for further replies.

Sorwen

Technical User
Nov 30, 2002
1,641
US
First, let’s get out of the way the fact you shouldn't do it. That doesn't matter. If it gets to the point where I need to do it (and have to go to the task manager to do so) then I need to do it whether I should or not.

So, that out of the way, how can I kill a thread? I can get the current ProcessThreads, but you can't kill a ProcessThread object just the whole process. I can't figure out how loop through all the active threads as threads so I can just abort/kill them. Can someone point me in the right direction?

-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
 
What about:
Code:
      Dim AllProcess As Process() = Process.GetProcessesByName("test.exe")
      For Each P As Process In AllProcess
         P.Kill()
      Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top