Nir P wrote:
>
>
> I'm trying to monitor the application on a window machine - I want to
> know when they start, finish, and when the user switch between them. I
> managed to monitor the creation and deletion of processes using
> Win32_Process.watch_for("creation") and
> Win32_Process.watch_for("deletion"), but didn't manage to monitor the
> times when the user switch the active window. I know I can get the
> current active window with
> win32gui.GetWindowText(win32gui.GetForegroundWindow()), but testing
> for changed for it in a loop doesn't sound like a good idea for
> performance, so I assume there is some event I can monitor? Any help,
> suggestions or reference to relevant reading material will be appreciated.
>You can install a windows hook to do this. A WH_CBT hook receives WM_ACTIVATE and WM_DEACTIVATE messages, which are the messages sent when a window receives and loses focus. However, I don't think you'll be able to stick to straight Python for this. You might look at the pyAA library at http://www.cs.unc.edu/assist/doc/pyaa to see if they could help. > Walla! Mail - Get your free unlimited mail today <http://www.walla.co.il> That's amazing. When someone uses the term "Walla!" like that, in virtually every case it is an ignorant rendition of the French word "Voila!" I'm amazed that a real company would choose that as a name. -- Tim Roberts, [email protected] Providenza & Boekelheide, Inc. _______________________________________________ python-win32 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-win32
