Microsoft DirectX 9.0


The SetPalette method attaches the DIRECTDRAWPALETTE specified to a surface.  The Surface will use this Palette for all subsequent operations. The palette change takes place immediately, without regard to refresh timing.


HRESULT SetPalette(



Pointer to the IDirectDrawPalette interface of the palette to use for future operations.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_NOEXCLUSIVEMODE Operation requires the application to have exclusive mode but the application does not have exclusive mode.
DDERR_NOT8BITCOLOR DirectDrawSurface is not in 8-bit color mode and the requested operation requires 8-bit color.
DDERR_UNSUPPORTED Action not supported.
DDERR_GENERIC Generic failure.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_NOPALETTEATTACHED No palette object attached to this surface.
DDERR_NOPALETTEHW No hardware support for 16- or 256-color palettes.
DDERR_SURFACELOST Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it.

See Also