Kill a named process in win2K not spawned by python

Syver Enstad syver-en+usenet at online.no
Wed Aug 6 23:40:27 CEST 2003


PoulsenL at capanalysis.com 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_TERMINATE, 1, pid)
win32api.TerminateProcess(handle, 1) # exit status


-- 

Vennlig hilsen 

Syver Enstad




More information about the Python-list mailing list