IDirectDrawSurface7::SetSurfaceDesc method (ddraw.h)

Sets the characteristics of an existing surface.

Syntax

HRESULT SetSurfaceDesc(
  [in] LPDDSURFACEDESC2 unnamedParam1,
  [in] DWORD            unnamedParam2
);

Parameters

[in] unnamedParam1

A pointer to a DDSURFACEDESC2 structure that contains the new surface characteristics.

[in] unnamedParam2

Currently not used and must be set to 0.

Return value

If the method succeeds, the return value is DD_OK.

If it fails, the method can return 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

Currently, you can use SetSurfaceDesc only to set the surface data and pixel format that is used by an explicit system-memory surface. This is useful because it allows a surface to use data from a previously allocated buffer without copying. The new surface memory is allocated by the client application, and therefore the client application must also deallocate it.

The DirectDrawSurface object does not deallocate surface memory that it did not allocate. Therefore, when the surface memory is no longer needed, you must deallocate it. However, when you call SetSurfaceDesc, DirectDraw frees the original surface memory that it implicitly allocated when it created the surface.

Requirements

Requirement Value
Target Platform Windows
Header ddraw.h
Library Ddraw.lib
DLL Ddraw.dll

See also

IDirectDrawSurface7