Adding Palette Message Handlers

The following example illustrates simple message handlers for the WM_PALETTECHANGED and WM_QUERYNEWPALETTE messages. The example uses the DrawDibRealize function to process the WM_QUERYNEWPALETTE message.

Your application should respond to the WM_QUERYNEWPALETTE message by invalidating the destination window to let the DrawDibDraw function redraw an image. You should respond to the WM_PALETTECHANGED message by using the DrawDibRealize function to realize the palette.

case WM_PALETTECHANGED:

if ((HWND)wParam == hwnd)

break;

case WM_QUERYNEWPALETTE:

hdc = GetDC(hwnd);

f = DrawDibRealize(hdd, hdc, FALSE) > 0;

ReleaseDC(hwnd, hdc);

if (f)

InvalidateRect(hwnd, NULL, TRUE);

break;

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database