public static final int POINT_Y(long i) { return (int) (i >> 32); } public static final int POINT_X(long i) { return (int) (i & 0xFFFF); } public interface User32Ex extends W32APIOptions { User32Ex instance = (User32Ex) Native.loadLibrary("user32", User32Ex.class, DEFAULT_OPTIONS); boolean GetCursorPos(long[] lpPoint); //use macros POINT_X() and POINT_Y() on long lpPoint[0] HWND WindowFromPoint(long point); } long[] getPos = new long [1]; User32Ex.instance.GetCursorPos(getPos); HWND hwnd = User32Ex.instance.WindowFromPoint(getPos[0]);
https://groups.google.com/forum/#!topic/jna-users/jVSfNCHMQ-M