[python-win32] Wait for a window with a specified title

Ram Rachum ram at rachum.com
Mon May 28 01:19:43 EDT 2018


On Mon, May 28, 2018 at 7:11 AM, Tim Roberts <timr at probo.com> wrote:

> On May 27, 2018, at 6:36 AM, Ram Rachum <ram at rachum.com> wrote:
> >
> > I'd like to use the `wmi` module to detect when a window with the title
> "Foo Bar" was created, and then kill the process that created this window.
> Is this possible?
>
> Not with WMI, no.
>
>
> > (I can do the killing without `wmi`, I just need to ID the process.)
> >
> > Note that I don't want to be periodically polling for that window, I
> want to be listening to an event so there wouldn't be a big delay.
>
> I don't know how much overhead you are willing to impose, but you can
> always install a WH_CALLWNDPROC window hook and look for WM_CREATE
> messages.  That injects a DLL into every process in the system, so I'm not
> convinced it can be done with Python.  You may need to write a C++ DLL and
> have it communicate with your Python process.
>

Oh, that sounds heavy. I guess I'm back to polling. Any idea how to do this
with polling?

Thanks for your help!


>> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> https://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20180528/71ccb3bd/attachment.html>


More information about the python-win32 mailing list