JNA call RegisterDeviceNotification fails with error 1066
问题 I am attempting to register for notifications on USB device arrival and device remove complete events from a java swing application. I have successfully called SetWindowLong(hWnd, MyUser32.GWLP_WNDPROC, listener); to register a listener and I am getting notifications of type WM_DEVICECHANGE . So far so good. Now I want to call RegisterDeviceNotification to ensure that I am notified of device arrival and remove complete events. Here is what I have tried: HWND hWnd = new HWND(); hWnd.setPointer