Java keyboard hook
I would like to write a Java app that counts how long I have been using the keyboard or mouse w/o a break. Are there any built-in classes or 3rd part开发者_运维技巧y libraries that can detect global keyboard/mouse use?
This can only be by using windows's hook function by JNI Someone already posted code here
EDIT: this on is better it also covers mouse events
The collection of files for rawinputsharp and the accompanying article might prove helpful. It's not Java-specific, but hopefully you can adapt it to suit.
精彩评论