You can explicitly restore the display hardware to its original mode by calling the IDirectDraw4::RestoreDisplayMode method. If the display mode was set by calling IDirectDraw4::SetDisplayMode and your application takes the exclusive cooperative level, the original display mode is reset automatically when you set the application's cooperative level back to normal. (This behavior was first offered in the IDirectDraw2 interface, and is offered by all newer versions of the interface.)
If you're using the IDirectDraw interface, you must always explicitly restore the display mode by using the RestoreDisplayMode method.