CBaseWindow.SetPalette method (Winutil.h)
SetPalette method installs a palette for the window.
virtual HRESULT SetPalette( HPALETTE hPalette );
Handle to the new palette. Cannot be NULL.
Returns one of the HRESULT values shown in the following table.
||An internal call to GdiFlush returned an error.
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.