|
Palette Messages
Changes to the system palette for the display device can have dramatic and
sometimes undesirable effects on the colors used in windows on the desktop. To
minimize the impact of these changes, Windows provides a set of messages that help
applications manage their logical palettes while ensuring that colors in the
active window are as close as possible to the colors intended.
Windows sends a WM_QUERYNEWPALETTE message to a top-level or overlapped window just before activating the
window. This message gives an application the opportunity to select and realize its
logical palette so that it receives the best possible mapping of colors for its
logical palette. When the application receives the message, it should use the SelectPalette, UnrealizeObject, and RealizePalette functions to select and realize the logical palette. Doing so directs Windows
to update colors in the system palette so that its colors match as many colors
in the logical palette as possible.
When an application causes changes to the system palette as a result of
realizing its logical palette, Windows sends a WM_PALETTECHANGED message to all top-level and overlapped windows. This message gives
applications the opportunity to update the colors in the client areas of their windows,
replacing colors that have changed with colors that more closely match the
intended colors. An application that receives the WM_PALETTECHANGED message should
use UnrealizeObject and RealizePalette to reset the logical palettes associated with all inactive windows and then
update the colors in the client area for each inactive window by using the UpdateColors function. This technique does not guarantee the greatest number of exact
color matches; however, it does ensure that colors in the logical palette are
mapped to reasonable colors in the system palette.
Note To avoid creating an infinite loop, an application should never realize the palette for the window whose handle matches the handle passed in
the wParam parameter of the WM_PALETTECHANGED message.
The UpdateColors function typically updates a client area of an inactive window faster than
redrawing the area. However, because UpdateColors performs color translation based on the color of each pixel before the system
palette changed, each call to this function results in the loss of some color
accuracy. This means UpdateColors cannot be used to update colors when the window becomes active. In such
cases, the application should redraw the client area.
Windows may send the WM_QUERYNEWPALETTE message when changes to the logical palette are made. Also, Windows may send
the WM_PALETTEISCHANGING message to all top-level and overlapped windows when the system palette is
about to change.
| Last news from Greatis Software |
 |
|
Nostalgia .Net |
|
.Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes. More » |
| Recommended software for developers |
 |
|
Ultimate Pack |
|
Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price. More » |
 |
|
Form Designer .Net |
|
Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro! More » |
 |
|
Print Suite .Net |
|
Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available More » |
 |
|
Gradient Controls .Net |
|
Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available More » |
 |
|
Greatis iGrid |
|
iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors. More » |
All the contacts and projectsDmitry Vasiliev (just.dmitry)
Related LinksSoftware for Visual Studio .NET developers Software for Delphi and C++ Builder developers Software for Visual Basic 6 developers Delphi Tips&Tricks MegaDetailed.NET More Online Helps Win32 Programmer's Reference Win32 Multimedia Programmer's Reference OLE Programmer's Reference Microsoft Windows Pen API Programmer's Reference Microsoft Windows Sockets 2 Reference Microsoft Windows Telephony API (TAPI) Programmer's Reference Unix Manual Pages
|