InitSurface method

Initializes a DXSurface object with the specified volume boundary and format from a Microsoft DirectDraw object.


HRESULT retVal = object.InitSurface(pDirectDraw, pDDSurfaceDesc, pFormatID, pBounds, dwFlags);


pDirectDraw [in]

Type: IUnknown

Required parameter for DXSurface objects. Pointer to the DirectDraw object to use to initialize the surface. Many procedural surfaces ignore this parameter.

pDDSurfaceDesc [in]


Pointer to the DDSURFACEDESC structure describing the DirectDrawSurface object; can be NULL.

pFormatID [in]

Type: const GUID

Pointer to the pixel format. If NULL, the default format for the surface can be used, or the pixel format in the DDSurfaceDesc can be used. For procedural surfaces, the pFormatID is equal to their CLSID.

pBounds [in]

Type: const DXBNDS

Pointer to the DXBNDS boundary structure that contains this surface's bounding volume. This parameter is optional for standard DXSurfaces because the bounds of the surface are already defined. It is required, however, for procedural surfaces.

dwFlags [in]


One or more of the DDSURFACEDESC flags that are passed to the IDXSurfaceFactory::CreateSurface method. These are DXSF_FORMAT_IS_CLSID and DXSF_NO_LAZY_DDRAW_LOCK. Procedural surfaces can ignore these flags.


The CDXBaseSurface base class implements this method for procedural surfaces. DXSurfaces that are created through CoCreateInstance must either be initialized through this interface or through one of the methods in the IDXARGBSurfaceInit interface before the surface can be used.

See also