[python-win32] (no subject)

Tim Roberts timr at probo.com
Tue Mar 23 23:11:36 CET 2010


Phung Thuy Vuong wrote:
>
>   Can anyone give me some hint please? I'm trying to make a log file
> which keep track of a specific application. For example, I need to
> punch the time et date where an application, such as Firefox, is
> opened and when it's closed. I also need to detect when the
> application goes to idle and when it's re-activate again. (I hope my
> question it's clear enough.) Thank you!

What you ask is complicated.  You need to install a "window hook" to
intercept the activate and deactivate messages going to all of the
top-level windows in the system.

The reason it's complicated is because of the way window hooks work. 
Your code must live in a DLL, and that DLL is injected into every
process in the system.  Thus, such a thing cannot be written in Python.

You could certainly have a simple hook DLL that reports statistics back
to some Python server "mother ship".  There are several web articles on
writing window hooks.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list