the links below have relevant details. here are some quotes.
Step 2:
Also, include a check for the device removed error when responding to window size changes.
This is a good place to check for DXGI_ERROR_DEVICE_REMOVED or DXGI_ERROR_DEVICE_RESET for several reasons:
Resizing the swap chain requires a call to the underlying DXGI adapter, which can return the device removed error.
The app might have moved to a monitor that’s attached to a different graphics device.When a graphics device is removed or reset, the desktop resolution often changes, resulting in a window size change.
It is safe to reset the GraphicsDevice like that ?
Reset is the only method that has an effect when a device is
lost, and is the only method by which an application can change the
device from a lost to an operational state.
Responding to a Lost Device
A lost device must re-create resources (including video memory resources) after it has been reset.
If a device is lost, the application queries the device to see if it can be restored to the operational state.
If not, the application waits until the device can be restored. If the device can be restored, the application
prepares the device by destroying all video-memory resources and any swap chains.
Then, the application calls the IDirect3DDevice9::Reset method.You are encouraged to develop applications with a single code path to respond to device loss.
This code path is likely to be similar, if not identical, to the code path taken to initialize the device at startup.
.
.
In Direct3D 9, vertex shaders and pixel shaders don’t need to be
re-created after reset. They will be remembered.