java - Unable to see the output while recording the key strokes using jnativeHook -
i'm trying record keystrokes when ever perform key events left,right,move,press,release etc.initially when wrote code , compiled able record key strokes.however,when compiled after little bit of code indentation showing following statement
process finished exit code 0
below posted code:
public class key_logger implements nativekeylistener { public void nativekeypressed(nativekeyevent e) { system.out.println("key pressed: " + nativekeyevent.getkeytext(e.getkeycode())); if (e.getkeycode() == nativekeyevent.vk_escape) { globalscreen.unregisternativehook(); } } public void nativekeyreleased(nativekeyevent e) { system.out.println("key released: " + nativekeyevent.getkeytext(e.getkeycode())); } public void nativekeytyped(nativekeyevent e) { system.out.println("key typed: " + e.getkeytext(e.getkeycode())); } public static void main(string[] args) { try { globalscreen.registernativehook(); } catch (nativehookexception ex) { system.err.println("there problem registering native hook."); system.err.println(ex.getmessage()); system.exit(1); } //construct example object , initialze native hook. globalscreen.getinstance().addnativekeylistener(new key_logger()); } }
Comments
Post a Comment