DirectX SDK

DirectDrawSurface7.SetPalette

The DirectDrawSurface7.SetPalette method attaches a palette object to (or detaches one from) a surface. The surface uses this palette for all subsequent operations. The palette change takes place immediately, without regard to refresh timing.

object.SetPalette(ddp As DirectDrawPalette)

Parameters

object
Object expression that resolves to a DirectDrawSurface7 object.
ddp
DirectDrawPalette object for the palette object to be used with this surface. If this parameter is Nothing, the current palette is detached.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_GENERIC
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_INVALIDPIXELFORMAT
DDERR_INVALIDSURFACETYPE
DDERR_NOEXCLUSIVEMODE
DDERR_NOPALETTEATTACHED
DDERR_NOPALETTEHW
DDERR_NOT8BITCOLOR
DDERR_SURFACELOST
DDERR_UNSUPPORTED

Remarks

If you pass Nothing as the ddp parameter, the palette is removed from the surface.

See Also

DirectDrawSurface7.GetPalette, DirectDraw7.CreatePalette