--
You received this message because you are subscribed to the Google Groups "Java Native Access" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jna-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
this.prevWndProc = MyUser32.INSTANCE.GetWindowLong(hWnd, User32.GWL_WNDPROC);
this.wndProcCallbackListener = new MyWinProc();
MyUser32.INSTANCE.SetWindowLong(hWnd, User32.GWL_WNDPROC, wndProcCallbackListener);
public class MyWinProc implements WinUser.WindowProc {
@Override
public WinDef.LRESULT callback(WinDef.HWND hWnd, int uMsg, WinDef.WPARAM uParam, WinDef.LPARAM lParam) {
return MyUser32.INSTANCE.CallWindowProc(prevWndProc, hWnd, uMsg, uParam, lParam);
}
}
Pointer previousFunction;
if (is64Bit())
previousFunction = User32RW.INSTANCE.SetWindowLongPtr(handle, GWLP_WNDPROC,listener);
else
previousFunction = User32RW.INSTANCE.SetWindowLong(handle, GWLP_WNDPROC,listener);
public static boolean is64Bit() { String model = System.getProperty("sun.arch.data.model"); return model.equals("64");
}
Pointer SetWindowLongPtr(HWND hWnd, int nIndex, MyWindowProc callback);
Pointer SetWindowLong(HWND hWnd, int nIndex, MyWindowProc callback);
LRESULT CallWindowProc(Pointer previousFunction, HWND hWnd, int uMsg, WPARAM wParam, LPARAM lParam);
public static interface MyWindowProc extends StdCallCallback {
com.sun.jna.platform.win32.WinDef.LRESULT callback(com.sun.jna.platform.win32.WinDef.HWND hwnd, int uMsg, com.sun.jna.platform.win32.WinDef.WPARAM wparam, Pointerlparam);
}
com.sun.jna.LastErrorException: [2] The system cannot find the file specified.
at com.sun.jna.Native.invokeInt(Native Method)
at com.sun.jna.Function.invoke(Function.java:383)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.openfin.$Proxy0.CallWindowProc(Unknown Source)
at com.openfin.WinMsg$1.callback(WinMsg.java:44)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:470)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:500)
at sun.awt.windows.WToolkit.eventLoop(Native Method)
at sun.awt.windows.WToolkit.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
throws LastErrorException means basically "if this function sets Kernel32.INSTANCE.GetLastError() to anything but zero, throw an exception". Apparently the default handler sets it to 2 sometimes. So your fix is easy: remove throws LastErrorException. Optionally you can try to locate the people responsible for the default handler for Java frames and make them fix their code, but that exercise is left to the reader :)
Cheers,
Will