CBaseWindow.SetPalette method (Winutil.h)

The SetPalette method installs a palette for the window.

Syntax

virtual HRESULT SetPalette(
   HPALETTE hPalette
);

Parameters

hPalette

Handle to the new palette. Cannot be NULL.

Return value

Returns one of the HRESULT values shown in the following table.

Return code Description
S_FALSE
An internal call to GdiFlush returned an error.
S_OK
Success.

Remarks

If the value of the CBaseWindow::m_bNoRealize member variable is FALSE (the default), this method selects the palette and realizes it. Otherwise, it selects the palette but does not realize it. The object does not delete any previous palette that it was using. The caller is responsible for deleting palettes.

Any thread can safely call this method, not just the thread that owns the window. The window sends a private message to itself, which triggers a call to the CBaseWindow::OnPaletteChange method.

Requirements

Header
Winutil.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CBaseWindow Class