How can I access a hardware button in Java

I have an industrial touchscreen tablet device running windows7 (this is one ). It has a built-in RFID / barcode scanner and camera. Both can be triggered using a hardware button. I would like to know when one of these buttons is pressed. I wrote a small test application using GlobalKeyEventListener, but no events are fired when one of these buttons is pressed. All regular keyboard events are triggered. Does anyone know if and how these types of button events can be accessed in Java? What else should I try before telling the client that this is not possible. Thanks.

+6
source share
1 answer

There will be some programming interface for listening to these buttons, and it is unlikely that it will be connected to the built-in Java virtual machine. I would consider writing a program / service / that listened to these button presses that I could compile into a Windows DLL, and then I would name the DLL from a Java program. Windows DLLs can listen to things, and Java classes can register as listeners for events from the DLL. It is unlikely to be trivial, the most difficult for me will be the DLL program itself (there is no java there, C or C # or something that Microsoft likes), followed by its own Java interface or API or something else to call Dll.

If you get to this, I recommend a product whose name I do not remember; it allows you to call DLLs without using any JNI glue code, i.e. Before, you had to write C code with a very specific set of rules for invoking Java, and this other product completely eliminates this.

Good luck.

+1
source

All Articles