Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Late answer but hopefully helpful :)</p> <p>You can using JNA, it's a cakewalk!!</p> <ol> <li>get JNA (jna.jar)</li> <li><p>create your own mapping for User32 (User32.dll) in the form</p> <pre> public interface User32 extends StdCallLibrary { User32 INSTANCE = (User32) Native.loadLibrary("User32", User32.class, Options.UNICODE_OPTIONS); // dwWakeMask Constants public static final int QS_ALLEVENTS = 0x04BF; public static final int QS_ALLINPUT = 0x04FF; public static final int QS_ALLPOSTMESSAGE = 0x0100; public static final int QS_HOTKEY = 0x0080; public static final int QS_INPUT = 0x407; public static final int QS_KEY = 0x0001; public static final int QS_MOUSE = 0x0006; public static final int QS_MOUSEBUTTON = 0x0004; public static final int QS_MOUSEMOVE = 0x0002; public static final int QS_PAINT = 0x0020; public static final int QS_POSTMESSAGE = 0x0008; public static final int QS_RAWINPUT = 0x0400; public static final int QS_SENDMESSAGE = 0x0040; public static final int QS_TIMER = 0x0010; public static final int INFINITE = 0xFFFFFFFF; /* DWORD WINAPI MsgWaitForMultipleObjects( __in DWORD nCount, __in const HANDLE *pHandles, __in BOOL bWaitAll, __in DWORD dwMilliseconds, __in DWORD dwWakeMask );*/ int MsgWaitForMultipleObjects(int nCount, Pointer pHandles, boolean bWaitAll, int dwMilliSeconds, int dwWakeMask); /* fsModifiers vaues */ public static final int MOD_ALT = 0x0001; public static final int MOD_CONTROL = 0x0002; public static final int MOD_NOREPEAT = 0x4000; public static final int MOD_SHIFT = 0x0004; public static final int MOD_WIN = 0x0008; /* BOOL WINAPI RegisterHotKey( __in_opt HWND hWnd, __in int id, __in UINT fsModifiers, __in UINT vk ); */ boolean RegisterHotKey(Pointer hWnd, int id, int fsModifiers, int vk); } </pre></li> <li><p>Just check out the following pages to get a clear idea of how things work under the hood: </p></li> </ol> <p>h**p://msdn.microsoft.com/en-us/library/ms646309%28VS.85%29.aspx</p> <p>h**p://msdn.microsoft.com/en-us/library/ms684242%28VS.85%29.aspx</p> <ol> <li>Check this page to see what are the key constants you can register a callback for</li> </ol> <p>h**p://msdn.microsoft.com/en-us/library/dd375731%28v=VS.85%29.aspx</p> <ol> <li>Create a test program like this:</li> </ol> <pre> User32 user32 = User32.INSTANCE; boolean res = user32.RegisterHotKey(Pointer.NULL, 9999, User32.MOD_ALT | User32.MOD_CONTROL, WINUSER.VK_LEFT); if(!res) System.out.println("Couldn't register hotkey"); System.out.println("Starting and waiting"); user32.MsgWaitForMultipleObjects(0, Pointer.NULL, true, User32.INFINITE, User32.QS_HOTKEY); System.out.println("Ending"); </pre> <p>User32.INFINITE is an undocumented constant with value 0xFFFFFFFF</p> <p>Sorry about the http links renamed into h**p :) Stackoverflow rules Stefano</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload