I am making an automatic clicker that uses jna to connect global keyboard and mouse input. For the keyboard, use http://code.google.com/p/goldriver/source/browse/trunk/king/src/jnacontrib/w32keyhook/KeyHook.java?r=36 .
I was wondering if there is any possible way to use a key event so that other applications do not handle it?
Fixed with the return of the new LRESULT (1);
Now I have a problem with not continuing with the rest of the code, here is the source. My program continues to listen to keyboard input and does not even continue to show a graphical interface.
public class GUI extends javax.swing.JFrame{ ArrayList<MEvent> events; public static final int RUNNING = 0; public static final int PAUSED = 1; public static final int STOPPED = 2; public static final int LISTENING = 3; private int process = STOPPED; private String display; private JTable Events; DefaultTableModel list; Loader loader; private static MouseHook mh; static private KeyHook kh; static GUI gui; Robot robot; public GUI() { initComponents(); loader = new Loader(this); events = new ArrayList<MEvent>(); list = new DefaultTableModel(); mh = new MouseHook(this,list); mh.setMouseHook(); list.addColumn("Type"); list.addColumn("X"); list.addColumn("Y"); list.addColumn("Sleep"); try { robot = new Robot(); } catch (AWTException ex) {} displayProcess(process); Events.setModel(list); kh = new KeyHook(this); kh.run(); } public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { gui = new GUI(); gui.setVisible(true); } }); } } public class KeyHook implements Runnable{ private static volatile boolean quit; private static HHOOK hhk; private static LowLevelKeyboardProc keyboardHook; private GUI gui; User32 lib; HMODULE hMod; public boolean isHooked = false; public KeyHook(final GUI gui) { this.gui = gui; lib = User32.INSTANCE; hMod = Kernel32.INSTANCE.GetModuleHandle(null); Native.setProtected(true); } @Override public void run() { keyboardHook = new LowLevelKeyboardProc() { public LRESULT callback(int nCode, WPARAM wParam, KBDLLHOOKSTRUCT info) { if (nCode >= 0) { switch (wParam.intValue()) { case WinUser.WM_KEYUP: switch(info.vkCode){
source share