Compartilhar via


IDirectDrawSurface5::SetSurfaceDesc (Windows CE 5.0)

Send Feedback

This method sets the characteristics of an existing surface.

HRESULT SetSurfaceDesc(LPDDSURFACEDESC2 lpddsd2, DWORD dwFlags);

Parameters

  • lpddsd2
    Address of a DDSURFACEDESC2 structure that contains the new surface characteristics.
  • dwFlags
    This parameter is currently not used and must be set to zero.

Return Values

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_INVALIDPARAMS
DDERR_INVALIDOBJECT
DDERR_SURFACELOST
DDERR_SURFACEBUSY
DDERR_INVALIDSURFACETYPE
DDERR_INVALIDPIXELFORMAT
DDERR_INVALIDCAPS
DDERR_UNSUPPORTED
DDERR_GENERIC

Remarks

The SetSurfaceDesc method allows a surface to use data from a previously allocated buffer without copying.

You can only use this method to set the surface data and pixel format that is used by an explicit system memory surface. The new surface memory is allocated by the client application and, as such, the client application must also deallocate it.

Using this method incorrectly can cause unpredictable behavior. In particular, the DirectDrawSurface object will not deallocate surface memory that it did not allocate. Therefore, when the surface memory is no longer needed, be sure to deallocate it.

When this method is called, DirectDraw frees the original surface memory that was allocated implicitly when the surface was created.

If your video driver supports allocating system memory surfaces, do not use SetSurfaceDesc as some drivers do not respond correctly to this method. Instead, use the IDirectDraw4::CreateSurface method to allocate the surfaces.

Requirements

OS Versions: Windows CE 2.12 and later. Version 2.12 requires DXPAK 1.0 or later.
Header: Ddraw.h.
Link Library: Ddraw.lib.

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.