Windows 3.1 Device Drivers (ddag31qh.hlp) (Table of Contents; Topic list)
SETCOLORTABLE
                                                     Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define SETCOLORTABLE 4 
short Control(lpDevice, SETCOLORTABLE, lpColorEntry, lpColor)
LPPDEVICE lpDevice;
LPWORD lpColorEntry;
LPLONG lpColor;
 
The SETCOLORTABLE escape sets an RGB color-table entry. If the device cannot
supply the exact color, the function sets the entry to the closest possible
approximation of the color.
 
Parameter     Description
────────────────────────────────────────────────────────────────────────────
 
 
lpDevice      Points to a PDEVICE structure specifying the destination
              device.
 
lpColorEntry  Points to a COLORTABLE_STRUCT structure.
 
lpColor       Points to a 32-bit variable that receives the RGB color value
              selected by the device driver to represent the requested color
              value.
 
Return Value
 
The return value is positive if the escape is successful. Otherwise, it is
negative.
 
Comments
 
A device's color table is a shared resource; changing the system display
color for one window changes it for all the windows.
 
The SETCOLORTABLE escape has no effect on devices with fixed-color tables.
 
This escape is intended for use by both printer and display drivers.
However, the EGA and VGA color drivers do not support it. It should not be
used with palette-capable display devices.
 
It is used by applications that want to change the palette used by the
display driver. However, since the driver's color-mapping algorithms will
probably no longer work with a different palette, an extension has been
added to this escape.
 
If the color index pointed to by the lpColorEntry parameter is 0xFFFFH, the
driver is to leave all color-mapping functionality to the calling
application. The application will necessarily know the proper color-mapping
algorithm and take responsibility for passing the correctly mapped physical
color to the driver (instead of the logical RGB color) in functions such as
RealizeObject and ColorInfo.
 
For example, if the device supports 256 colors with palette indexes of 0
through 255, the application would determine which index contains the color
that it wants to use in a certain brush. It would then pass this index in
the low byte of the logical color passed to RealizeObject. The driver would
then use this color exactly as passed instead of performing its usual
color-mapping algorithm. If the application wants to reactivate the driver's
color-mapping algorithm (that is, if it restores the original palette when
switching from its window context), then the color index pointed to by
lpColorEntry should be 0xFFFEH.
 
See Also
 
ColorInfo, GETCOLORTABLE, RealizeObject, COLORTABLE_STRUCT, PDEVICE
 
 
                                      ♦