Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Kill a named process in win2K not spawned by python

Reply
Thread Tools

Kill a named process in win2K not spawned by python

 
 
PoulsenL@capanalysis.com
Guest
Posts: n/a
 
      08-06-2003
Can someone give me a clue how to rewrite this kludgy workaround in python?

import os
from win32pdhutil import *
pid = FindPerformanceAttributesByName("WINWORD")[0]
os.system("C:\CMDUtils\kill " + str(pid))

Thanks,

Loren Poulsen

--------------------------------------------------------------------------------------------------------------------
This email and any attachments contain information from CapAnalysis, LLC, which may be confidential and/or privileged. The information is intended to be for the use of the individual or entity named on this email. If you are not the intended recipient, be aware that any disclosure, copying, distribution or use of the contents of this email is prohibited. If you receive this email in error, please notify us by reply email immediately so that we can arrange for the retrieval of the original documents at no cost to you.

 
Reply With Quote
 
 
 
 
Syver Enstad
Guest
Posts: n/a
 
      08-06-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) writes:

> Can someone give me a clue how to rewrite this kludgy workaround in
> python?
>
>
> import os
> from win32pdhutil import *
> pid = FindPerformanceAttributesByName("WINWORD")[0]


import win32process, win32api, win32con
handle = win32api.OpenProcess(win32con.SYNCHRONIZE|win32con .PROCESS_QUERY_INFORMATION|win32con.PROCESS_TERMIN ATE, 1, pid)
win32api.TerminateProcess(handle, 1) # exit status


--

Vennlig hilsen

Syver Enstad
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spawned process output rwfields@yahoo.com Java 2 02-17-2006 11:07 PM
how to kill a spawned process when it hangs dn_perl@hotmail.com Perl Misc 1 05-04-2005 12:55 PM
kill a python script spawned from java/Jython The Dude Python 0 07-30-2004 05:00 PM
How to get return value from a spawned process? Peter C++ 1 03-03-2004 01:27 AM
Re: close gui, let spawned process run Steve W. Jackson Java 0 07-24-2003 02:59 PM



Advertisments