pyHook or SetWindowsHookEx

A

abcd

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.
 
S

sturlamolden


The answer depends on which GUI library you use.

E.g. if you use MFC there is an object called win32ui.PyCWnd that has
methods for hooking key strokes.
 
J

Jordan

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.

Cheers,
Jordan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top