pyHook or SetWindowsHookEx

Jordan jordan.taylor2 at
Sun Mar 4 03:20:47 CET 2007

On Feb 27, 9:01 am, "abcd" <codecr... at> wrote:
> I am having trouble with pyHook on python 2.4.1.  Basically I have a
> python app that uses pyHook to capture keyboard events and write them
> straight to a file.  The application is running as a service on a
> windows machine.  If I am at that windows machine the application
> works just fine, logging my keystrokes.  However, if I use Remote
> Desktop to connect to the machine and open up say Notepad it doesn't
> capture the keystrokes.  Is this a problem with pyHook?  or is it he
> way Windows handles the events?
> Is there a way to setup my own hook without pyHook using just python?
> i think the function I am interested in is SetWindowsHookEx.
> Thanks in advance.

I'm pretty sure it's not a problem with pyHook.  I'm also fairly sure
that you can't log the keystrokes of someone who is logged onto your
machine from another; that would be a major security flaw.  The only
way (I think) this would work is if you wrote your own remote desktop
program that logged keystrokes, and then sent it to the remote
computer when logging off.


More information about the Python-list mailing list