Perhaps you need to reset the environment variable "SDL_WINDOWID" to the new handle of the panel. The problem with that is you need to unload SDL first (I think) If youy are using this environment variable it's worth noting that it is only supported on Windows and Linux.

Or perhaps use SDL_GetWMInfo to get the video information and check which handle SDL thinks it's using.