kill a process in XP

T

Tor Erik Sønvisen

Hi.

From my Python-program I spawn a new process. When using P_NOWAIT spawnl
returns the pid but in windows it returns a process handle.
Later I want to kill this process. How can I do this when I only have the
process handle?

-tores-
 
D

Dave Brueck

Tor said:
returns the pid but in windows it returns a process handle.
Later I want to kill this process. How can I do this when I only have the
process handle?

Try ctypes - if it's really a Windows handle, then this should work:

from ctypes import *
windll.kernel32.TerminateProcess(h, 0) # or whatever return code you want

-Dave
 
C

Cameron Laird

Try ctypes - if it's really a Windows handle, then this should work:

from ctypes import *
windll.kernel32.TerminateProcess(h, 0) # or whatever return code you want

-Dave

I sometimes am so irritated with attendant portability issues
that I open a channel between parent and child, which I use to
send an exit-now message.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,221
Messages
2,571,133
Members
47,747
Latest member
swapote

Latest Threads

Top