DirectX SDK |
The IDirectDrawSurface7::SetSurfaceDesc method sets the characteristics of an existing surface.
HRESULT SetSurfaceDesc( LPDDSURFACEDESC2 lpddsd2, DWORD dwFlags );
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 |
Currently, this method can be used only to set the surface data and pixel format 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. For more information, see Updating Surface Characteristics.
Using this method incorrectly causes unpredictable behavior. The DirectDrawSurface object does not deallocate surface memory that it did not allocate. Therefore, when the surface memory is no longer needed, it is your responsibility to deallocate it. However, when this method is called, DirectDraw frees the original surface memory that it implicitly allocated when creating the surface.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 98.
Header: Declared in ddraw.h.