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. Advertisements

  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. Advertisements

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. Replies:
    2
    Views:
    803
  2. Peter
    Replies:
    1
    Views:
    809
    Victor Bazarov
    Mar 3, 2004
  3. Isaac Raway

    Controlling a spawned process

    Isaac Raway, Jul 31, 2003, in forum: Python
    Replies:
    0
    Views:
    347
    Isaac Raway
    Jul 31, 2003
  4. The Dude
    Replies:
    0
    Views:
    707
    The Dude
    Jul 30, 2004
  5. Mike M
    Replies:
    11
    Views:
    1,147
    Dave Cole
    Nov 29, 2004
  6. Vishal Sethia

    Owner of spawned process in threads

    Vishal Sethia, Oct 4, 2007, in forum: Python
    Replies:
    1
    Views:
    323
    Piet van Oostrum
    Oct 4, 2007
  7. subrahmanya
    Replies:
    1
    Views:
    557
  8. Replies:
    1
    Views:
    175
    Tad McClellan
    May 4, 2005
Loading...