Reputation: 81
I have a swing Java application (A) that launches another application (B) using Runtime.getRuntime().exec()
when a certain button is pressed.
Is it possible to set a certain Key Hook so that when the application (B) is open and active, it changes the buttons (for example, when you press "Q", in fact, the "H" button is pressed, and so on). And a similar situation for the mouse (for example, if "Mouse Mid" or "Mouse Wheel" is pressed, in fact another button is pressed, for example "T").
Ideally, it should work for all operating systems if possible, but Windows primarily.
Please tell me if it is possible to implement this at all, I will be glad to any advice or examples.
Upvotes: 0
Views: 137
Reputation: 1025
As you want to hook with operating system's low level events. It could require JNI implementation that could be complex and will require OS libraries. There is one Maven library available at Github https://github.com/kristian/system-hook
It contains required libs as mentioned in Readme.md file. I haven't tried this. Hopefully it should work.
Upvotes: 1