Moved error handling out of GetWindowSharedSurfaceHandle