How do you record keystrokes when operating on another window in Java?

I'm looking to record keystrokes and mouse positions while I'm in a browser window on various websites, but I'm not sure how to do this outside the SWING (or some other GUI) window.

How can I record keystrokes when a different application's window is the one active?

-------------Problems Reply------------

The support you need is not exposed by Java. It is a fairly simple matter to do this if you have access to the RECORD extension in X, or Win32 on Windows.

Here is a Python project that implements support for both of these platforms: pykeylogger.

(Windows only) In theory you could use JNA or JNI to bind to GetAsyncKeyState and you'd be able to monitor key presses.

I don't think you can do this from pure Java. If it is possible at all, it would require the assistance of a (highly) platform specific native code library.

Category:java Views:0 Time:2010-01-06

Related post

Copyright (C), All Rights Reserved.

processed in 0.158 (s). 11 q(s)