private static long getHwnd(Canvas parent) throws LWJGLException { AWTCanvasImplementation awt_impl = AWTGLCanvas.createImplementation(); WindowsPeerInfo parent_peer_info = (WindowsPeerInfo) awt_impl.createPeerInfo(parent, null, null); ByteBuffer parent_peer_info_handle = parent_peer_info.lockAndGetHandle(); try { return parent_peer_info.getHwnd(); } finally { parent_peer_info.unlock(); } }