how to terminate a process on win32?

J

Joe Wong

Hi,

I am developing two app on Windows, one is a GUI using wxPython and the other is like a daemon process. The GUI app will have a start/stop button to control the excution of the daemon. While I know how to use os.popen2() to start my daemon, I can't figure out a way to stop it 'nicely'... Is there anything that I can do?

Regards,

-- Wong
 
D

David Fraser

Joe said:
Hi,

I am developing two app on Windows, one is a GUI using wxPython and the
other is like a daemon process. The GUI app will have a start/stop
button to control the excution of the daemon. While I know how to use
os.popen2() to start my daemon, I can't figure out a way to stop it
'nicely'... Is there anything that I can do?

Regards,

-- Wong

You can use the win32process.TerminateProcess function to kill a
process... see the win32 docs

David
 
H

Hung Jung Lu

Joe Wong said:
I am developing two app on Windows, one is a GUI using wxPython and the
other is like a daemon process. The GUI app will have a start/stop
button to control the excution of the daemon. While I know how to use
os.popen2() to start my daemon, I can't figure out a way to stop it
'nicely'... Is there anything that I can do?

It depends on your OS. I remember once upon a time, in order to kill
processes sucessfully for all Windows platforms (from Win98 to NT to
2000/XP), I had to resort to using tlist.exe and kill.exe, plus
w9xpopen.exe for pipes in Windows 98. It was kind of annoying... I
seem to remember short name and long names were problem, too. At the
end, the killing logic became a small program in itself!

regards,

Hung Jung
 
J

Joe Wong

But calling TerminateProcess will stop the application right away. I need
someway that the process being killed get notified and thus to carry out
some procedure before shut down. On Linux, I can use kill(pid, signum) to
achive this but on windows?


----- Original Message -----
From: "Myles" <[email protected]>
Newsgroups: comp.lang.python
To: <[email protected]>
Sent: Wednesday, May 26, 2004 9:49 AM
Subject: Re: how to terminate a process on win32?
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top