Closed osaulonery closed 9 months ago
Events that are received from the native hook are added to a queue before they are processed, so there is no way of preventing the default behavior of the key press. Also in terms of the Windows API, this would be unreliable, as Windows treats key / mouse hooks as a chain, so it‘ll depend on where you are in the chain on what you can supress. Short answer: no you can unfortunately not consume the key.
I was trying something like that, but doesnt have consume.
public void keyPressed(GlobalKeyEvent event) { int keyCode = event.getVirtualKeyCode(); if (keyCode == 0x31 || keyCode == 0x32) { event.consume(); } }