Kill a named process in win2K not spawned by python

Discussion in 'Python' started by PoulsenL@capanalysis.com, Aug 6, 2003.

  1. Guest

    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.
    , Aug 6, 2003
    #1
    1. Advertising

  2. Syver Enstad Guest

    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
    Syver Enstad, Aug 6, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve W. Jackson

    Re: close gui, let spawned process run

    Steve W. Jackson, Jul 24, 2003, in forum: Java
    Replies:
    0
    Views:
    413
    Steve W. Jackson
    Jul 24, 2003
  2. Replies:
    2
    Views:
    706
  3. Peter
    Replies:
    1
    Views:
    727
    Victor Bazarov
    Mar 3, 2004
  4. The Dude
    Replies:
    0
    Views:
    619
    The Dude
    Jul 30, 2004
  5. Replies:
    1
    Views:
    110
    Tad McClellan
    May 4, 2005
Loading...

Share This Page