IDirectDrawSurface7::SetSurfaceDesc method

Sets the characteristics of an existing surface.

Syntax


HRESULT SetSurfaceDesc(
  [in]  LPDDSURFACEDESC2 lpDDsd2,
  [in]  DWORD dwFlags
);

Parameters

lpDDsd2 [in]

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

dwFlags [in]

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.

You must use LoadLibrary to explicitly link to Ddraw.dll and then use GetProcAddress to access the SetSurfaceDesc method.

Requirements

Header

Ddraw.h

Library

Ddraw.dll

See also

IDirectDrawSurface7

 

 

Community Additions

ADD
Show:
© 2014 Microsoft