##### Creating the Primary Surface

The primary surface is the surface currently visible on the monitor and is identified by the DDSCAPS_PRIMARYSURFACE flag. You can only have one primary surface for each DirectDraw object.

When you create a primary surface, the dimensions implicitly match the current display mode. Therefore, this is the one time you don’t need to declare surface dimensions. Frankly, if you do specify them, the call fails-even if they match the current display mode.

The following example shows how to prepare the DDSURFACEDESC structure members relevant for creating the primary surface.

DDSURFACEDESC ddsd;

ddsd.dwSize = sizeof(ddsd);

// Tell DirectDraw which members are valid.

ddsd.dwFlags = DDSD_CAPS;

// Request a primary surface.

ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;