|Microsoft DirectX 9.0|
The SetPalette method installs a palette for the window.
virtual HRESULT SetPalette( HPALETTE hPalette ); HRESULT SetPalette(void);
Handle to the new palette. Cannot be NULL.
Returns one of the HRESULT values shown in the following table.
|S_FALSE||An internal call to GdiFlush returned an error.|
The hPalette parameter specifies a new palette. If the method is called with no parameters, the palette given by the CBaseWindow::m_hPalette member variable is selected. The caller must ensure the validity of m_hPalette.
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.