pyHook equivalent for WH_SHELL hooks?

Jan Böcker usenet.jan at jboecker.de
Sat Apr 21 13:06:05 EDT 2007


Hi,

i want to write an app which has to log various user activity, such as opening 
folders and office documents, to help the user keep an overview about what open 
windows are related to one task he/she is currently doing.

I thought of using a windows shell hook, which notifies the program similar to a 
keyboard hook when a top-level window is created or destroyed. The pyHook 
extension shows that this is possible, but only supports keyboard and mouse hooks.

My own experiments have not succeeded, as I never have programmed in C/C++ 
before, let alone a python extension, but I am willing to learn. (I managed to 
do a test extension without any useful functionality).

I have difficulties understanding how my hook will cope with multithreading. As 
far as I understand, a windows hook dll is loaded into the address space of 
every running program. How does a hook handle concurrency and how exactly does 
it call the python function? Will the python function run on another thread? How 
do I call a python function on another thread?

pyHook claims to be open source, but I could only find the python part of the 
source, the C part seems to be missing on sourceforge.net (correct me if I am 
wrong).

Is there already something like pyHook for WH_SHELL hooks?
If not, how does pyHook work internally and is its C source available?

I would be glad if anybody could help or point me in the right direction. I 
already tried the de.comp.lang.python and a web forum full of nerds ;)

Regards,
Jan Böcker



More information about the Python-list mailing list