[python-win32] How to get the main window handle of an application started with win32process.CreateProcess() ?

Pierre Rouleau prouleau at impathnetworks.com
Wed Mar 23 19:17:37 CET 2005


Hi all,

     I am trying to send a WM_CLOSE mesage to the main window of a Win32 
GUI application I started with win32process.CreateProcess().  I want to 
terminate the application gracefully, allowing the application to 
perform all of its regular cleanup and prompting it normally does when 
the user requests to close it.

For that reason, I do not want to use win32process.TerminateProcess().

Since I started the application with win32process.CreateProcess() I have 
the process information.  But to use win32gui.PostMessage() to the 
application main window I must find the main window handle of that 
application.

Does anyone know how to do this?

Thanks in advance.

Pierre Rouleau



More information about the Python-win32 mailing list