A Direct3D device can be thought of as a rendering target for Direct3D. It encapsulates and stores the rendering state.
The Direct3D Immediate Mode device object supports two interfaces, IDirect3DDevice and IDirect3DDevice2. These two interfaces abstract two styles of programming in Direct3D Immediate Mode. IDirect3DDevice allows programming using execute buffers. IDirect3DDevice2 is a more immediate interface that allows you to draw primitives directly. The interfaces share a few common methods that are useful in either programming style. These have been replicated in both the interfaces to reduce the need to call the QueryInterface method between each interface.
You can call the IDirect3D2::CreateDevice method to create a Direct3D device object. This method retrieves an IDirect3DDevice2 interface. The object, however supports both device interfaces; you can retrieve an IDirect3DDevice interface by calling the IDirect3DDevice2::QueryInterface method.
When you create an IDirect3DDevice2 interface, the Direct3D device object is a separate object from a DirectDraw surface object. The device object uses a DirectDraw surface as a rendering target. This behavior is different from IDirect3DDevice, in which Direct3D devices are simply interfaces to DirectDraw surfaces. Keeping devices as separate objects with independent lifetimes from DirectDraw surfaces allows a single 3-D device object to use different DirectDraw surfaces as render targets at different times (for information about this, see IDirect3DDevice2::SetRenderTarget). For more information on backward compatibility and the differences between DirectX 3 and DirectX 5, see Compatibility with DirectX 3.