rename running windows exe?
TeaAndBikkie
teaandbikkie at aol.com
Mon Oct 21 16:35:15 EDT 2002
>From: Pete Shinners pete at shinners.org
>... win32 question, ...
>
>i'm trying to write a simple script that will help me manage distribution
>of files on multiple platforms. i need a way to rename or move or delete an
>executable or dll that is running. perhaps it's a thing that windows will
>simply not allow.
>
>if not, is there a way i can find the offending processes and offer to send
>them a QUIT message? some simple dialog, "you need to close the following
>programs: notepad, shall i try to close them for you?"
You can use the win32 API to post a QUIT message to a window, that might help:
import win32api, win32con # from Mark Hammond's win32 extensions
win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
or
win32gui.PostMessage(hwnd, win32con.WM_QUIT, 0, 0)
you can use win32api.FindWindow(...) to get the window handle.
I'm not sure if you can do anything with a running app/threads not related to a
window.
Kind regards,
Misha
More information about the Python-list
mailing list