Skip to content
Advertisement

JNativeHook Post a native key event

I tried to post a new native key pressing to the system using the java library https://github.com/kwhat/jnativehook. The method

JavaScript

Needs to get passed a NativeInputEvent object, which needs the Parameters

  • An instance of Global Screen
  • Two integers and one long

Based on the documentation I can’t figure out what the required parameters are and how to for example initialize a new GlobalScreen object. (https://github.com/kwhat/jnativehook/blob/master/src/java/org/jnativehook/NativeInputEvent.java)

Thanks for answers in advance!

Advertisement

Answer

With the help of the developer I solved the question. To post media key events to the system using jnativehook you can use the following code:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement