WM_QUERYNEWPALETTE
The WM_QUERYNEWPALETTE message informs an application that it is about to receive the input focus, giving the application an opportunity to realize its logical palette when it receives the focus.
This message has no parameters.
An application should return nonzero if it realizes its logical palette; otherwise, it should return zero.
This example shows how an application selects and realizes its logical palette:
HDC hdc;
HPALETTE hpalApp, hpalT;
UINT i;
/*
* If this application changed the palette, ignore the message.
*/
case WM_PALETTECHANGED:
if (wParam == hwnd)
return 0L;
/* Otherwise, fall through to WM_QUERYNEWPALETTE. */
case WM_QUERYNEWPALETTE:
/*
* If realizing the palette causes the palette to change,
* redraw completely.
*/
hdc = GetDC(hwnd);
hpalT = SelectPalette (hdc, hpalApp, FALSE);
i = RealizePalette(hdc); /* i == entries that changed */
SelectPalette (hdc, hpalT, FALSE);
ReleaseDC(hwnd, hdc);
/* If any palette entries changed, repaint the window. */
if (i > 0)
InvalidateRect(hwnd, NULL, TRUE);
return i;