[python-win32] Using Flexible Win32 message pump to monitor window open/close for all application?

reckoner reckoner at gmail.com
Thu Mar 31 15:14:34 CEST 2011



> ------------------------------
>
> Message: 3
> Date: Wed, 30 Mar 2011 16:17:01 -0700
> From: Tim Roberts<timr at probo.com>
> To: Python-Win32 List<python-win32 at python.org>
> Subject: Re: [python-win32] Using Flexible Win32 message pump to
> 	monitor window open/close for all application?
> Message-ID:<4D93B9ED.9010402 at probo.com>
> Content-Type: text/plain; charset="ISO-8859-1"
>
> reckoner wrote:
>> Which is listed in the Python cookbook, second edition. Is it possible
>> to use this to monitor the open/close of different windows? Basically, I
>> would like to trigger an action for a specific window or handle when
>> that window class or handle opens/closes. Can this recipe help with
>> that? Any ideas on getting started with this?
>
> Do you mean a window in another application?  That requires installing a
> Windows hook, and a Windows hook callback must reside in a DLL (so that
> DLL can be injected into the other process), which cannot be done in
> Python.  There is the pyHook package, but I don't know if it is still
> being developed.
>
> http://www.cs.unc.edu/Research/assist/developer.shtml
>

Thanks your reply.

I'm guessing from your response that the cookbook recipe can only deal 
with open/close events that it throws itself. So far, the only way I 
have found to monitor window open/close events is the Active 
Accessibility (AA) layer via pyAA. The problem is that AA is really 
dated and is theoretically supposed to be superseded by the UI 
automation layer, but there are no similar Python bindings for that (and 
it relies on the .NET framework ).

Here is the link for a description of pyAA:

http://web.archive.org/web/20080510165211/mindtrove.info/articles/gui-automation-with-pyaa/


Thanks!





More information about the python-win32 mailing list