Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This method creates a DirectDrawSurfaceobject for this DirectDrawobject.

Syntax

HRESULT CreateSurface(
  LPDDSURFACEDESC
 lpDDSurfaceDesc, 
  LPDIRECTDRAWSURFACE FAR* 
lplpDDSurface, 
  IUnknown FAR* 
pUnkOuter 
);

Parameters

lpDDSurfaceDesc

Address of a DDSURFACEDESCstructure that describes the requested surface. You should set any unused members of the DDSURFACEDESCstructure to zero before calling this method. A DDSCAPSstructure is a member of DDSURFACEDESC.

lplpDDSurface

Address of a variable that will be set to a valid IDirectDrawSurfaceinterface pointer if the call succeeds.

In all cases, call IDirectDrawSurface::QueryInterfaceto obtain a pointer to an IDirectDrawSurfaceinterface and then use the IDirectDrawSurfaceinterface for all of your DirectDraw programming in Windows Embedded CE.

pUnkOuter

Allows for future compatibility with COM aggregation functionality.

Presently, however, this method will return an error if this parameter is anything but NULL.

Remarks

DirectDraw does not support emulated surface flipping. Surface flipping in DirectDraw requires hardware support.

If your device does not support hardware flipping and you specify DDSCAPS_FLIP, the operation will fail with the DDERR_NOFLIPHW error code.

Return Value

If the method succeeds, the return value is DD_OK.

If the method fails, the return value may be one of the following error values:

DDERR_INCOMPATIBLEPRIMARY

DDERR_INVALIDCAPS

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_INVALIDPIXELFORMAT

DDERR_NOALPHAHW

DDERR_NOCOOPERATIVELEVELSET

DDERR_NOFLIPHW

DDERR_NOOVERLAYHW

DDERR_OUTOFMEMORY

DDERR_OUTOFVIDEOMEMORY

DDERR_PRIMARYSURFACEALREADYEXISTS

For more information on these error codes see DirectDraw Return Values.

Sample Code

An example showing the use of this function can be found in the topic How to use DirectDraw.

Requirements

Header ddraw.h
Library ddraw.lib
Windows Embedded CE Windows Embedded CE 6.0 and later
Windows Mobile Pocket PC for Windows Mobile Version 5.0 and later, Smartphone for Windows Mobile Version 5.0 and later