How to support remote desktop?

I am wondering if there is something to do in order to support switching back and forth from desktop to remote desktop?

Right now my game is getting exceptions whenever I switch to remote desktop or when I go back to direct desktop access.

Most of the time it looks like the audio device changing is the cause, in the exception stack, I can see MMDevAPI.dll OnDeviceRemoved. But I also get some exceptions processing message sent by WIN_PumpEvents(SDL_VideoDevice *).

What is the proper way of supporting remote desktop using SDL2?

Just got another exception caused by a call to DispatchMessage(&msg); in WIN_PumpEvents(SDL_VideoDevice *).
The windows message code is 96 if it helps.