David Hutto wrote:
> On Tue, Mar 23, 2010 at 6:11 PM, Tim Roberts <t...@probo.com> wrote:
>   
>> 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. ...
>>     
>
> I'm new so excuse the ignorance, and the simplicity of the idea, if
> it is, but couldn't you just monitor the process id's and then match
> the running/sleep/active usage instead of the dll's. You would only
> have to monitor the single system monitor. If I'm thinking about this
> correctly.
>   

Perhaps so -- the original poster will have to judge whether that's
sufficient.  On Linux, I think you could do that rather easily.  On
Windows, the sentence "just monitor the process ids" is not as trivial
as it sounds.  It's possible to use ToolHelp to run through the list of
processes, and the list of threads for those processes, then use
GetThreadTimes to get the CPU time.  That doesn't necessarily tell you
when an application gains and loses focus.  It all depends on what the
OP really needs to know.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to