##### Creating Overlay Surfaces

Like all surfaces, you create an overlay surface by calling the IDirectDraw2::CreateSurface method. To create an overlay, include the DDSCAPS_OVERLAY flag in the associated DDSCAPS structure.

Overlay support varies widely across display devices. As a result, you cannot be sure that a given pixel format will be supported by most drivers and must therefore be prepared to work with a variety of pixel formats. You can request information about the non-RGB formats that a driver supports by calling the IDirectDraw2::GetFourCCCodes method.

When you attempt to create an overlay surface, it is advantageous to try creating a surface with the most desirable pixel format, falling back on other pixel formats if a given pixel format isn’t supported.

You can create overlay surface flipping chains. For more information, see Creating Complex Surfaces and Flipping Chains.