Link to home
Start Free TrialLog in
Avatar of warcoder
warcoder

asked on

Getting keystrokes in

hi experts,

i was thinking if it were to be possible to develop a program to record all keystrokes and mouse clicks with the use of java technology.

I look forward to your prompt response.

ASKER CERTIFIED SOLUTION
Avatar of dbkruger
dbkruger

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nebeker
nebeker

Take a look at the Robot class...
There is no way to capture keystrokes and mouse movement outside of your application in java.  Java offers an API called JNI (Java Native Interface) which will allow you to run C/C++ classes inside of your java program.  You will have to write a system hook in C/C++ and then use JNI to incorporate it.  I don't know why you would go through the trouble of using JNI, when you could write the whole thing in C/C++.

Here is an article on JNI.  
http://java.sun.com/docs/books/tutorial/native1.1/ 

here is a tutorial in C# that uses a C++ hook.  It comes with source code.  
http://www.codeproject.com/csharp/GlobalSystemHook.asp


I hope this helps.

Brian
Avatar of warcoder

ASKER

thank you very much for your response.

The program should be able to trap all key strokes on the system. It will be working like a key logger. I am still thinking if this is possible.

I look forward to an urgent response.


Make your GUI as big as the Desktop and you will trap all keystrokes that it can catch.
;JOOP!
If that's not enough you got to write an interceptor to the keyboard.
That's far too difficult to re-invent.
You might contact people who wrote interceptors for foreign languages (composing into foreign characters).
One expert I've known is at vuhung@techviet.com (keyboard interceptor for Vietnamese),
you'll find some more at sourceforge.

;JOOP!
Avatar of CEHJ
Brahose is correct
the codes in the link brahose posted only works with C#. But i still know it is possible either one way or the other to capture key strokes. I might end up using JNI with C/C++,but where can i get pure C or C++ hook code.
At the places I mentioned. I'm using one of their products.
;JOOP!