[python-win32] Using WMI to listen to window creation and destruction
Tim Roberts
timr at probo.com
Wed Jul 18 14:45:41 EDT 2018
Ram Rachum wrote:
>
> I'd like to use the `wmi` module to be notified on the events of a
> window being created or destroyed. Is this possible? I looked at the
> tutorial and cookbook and could find many interesting things, but not
> that.
I don't think WMI provide information about windows, although admittedly
I've underestimated WMI in the past. If you have evidence to the
contrary, please correct me.
However, I'm pretty sure what you said is not really what you meant.
Remember that every control, every button, every textbox, every icon --
really, every visible thing is a separate window. You'd get thousands
of hits. Are you really looking to monitor the creation of new
top-level windows, which means the creation of new processes? Because
WMI DOES provide information about processes.
If you do want to find out about windows, you'd need to use a Windows hook.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list