IDirectDrawSurface2::SetPalette
HRESULT SetPalette(LPDIRECTDRAWPALETTE lpDDPalette);
Attaches the specified DirectDrawPalette object to a surface. The surface uses this palette for all subsequent operations. The palette change takes place immediately, without regard to refresh timing.
·Returns DD_OK if successful, or one of the following error values otherwise:
lpDDPalette
Address of the DirectDrawPalette structure that this surface should use for future operations.
If this method is called several times consecutively on the same surface for the same palette, the reference count for the palette is incremented only once. Subsequent calls do not affect the palette's reference count.