INF: Defining the Term "Color Scheme" in an OLE Context

ID Number: Q83459

3.10

WINDOWS

Summary:

This article defines the term "color scheme" in the context of an

application that supports object linking and embedding (OLE). The key

point is the distinction between an OLE color scheme and the hardware

palette. The functions related to the OLE color scheme use a

LOGPALETTE data structure to hold data and can use this information to

change the system palette as appropriate.

More Information:

The definition of color scheme used by an OLE application would be

familiar to users of Microsoft PowerPoint for Windows. The color

scheme is a combination of a foreground color, a background color, a

number of fill colors, and a number of line colors that PowerPoint

uses to render objects on the slides of the presentation. If you edit

an object that is embedded in PowerPoint, it can send the applicable

color scheme to the OLE server so it can use the same colors to render

the embedded object in its window.

An OLE client application allocates memory for a LOGPALETTE data

structure and fills the structure with its preferred colors. This

palette contains the colors that the client application suggests for

use as its foreground color, background color, fill color, and line

color. The palNumEntries field of the LOGPALETTE structure contains

the number of total colors in this color scheme. The palPalEntry array

contains the colors.

The first color is the suggested foreground color and the second is

the suggested background color. Of the remaining colors, the first

half are suggested fill colors, with the second half containing

suggested line colors. If there are an odd number of entries, then the

extra color is a fill color -- that is, there is one fewer line color

than fill colors. For example, if there are nine entries in the entire

color scheme, the first two are the foreground and background colors,

the next four are fill colors, and the final three are line colors.

Because the LOGPALETTE data structure does not contain colors for the

video hardware, the OLE client cannot specify the structure in a call

to the CreatePalette or RealizePalette functions. However, the OLE

client can use the information in the LOGPALETTE data structure to

affect the hardware palette.

The client application calls the OleSetColorScheme to pass the

structure to the OLE server. The server receives notification of the

preferred colors through SetColorScheme methods in the server's

OLESERVERDOCVTBL and OLEOBJECTVTBL structures.

Additional reference words: 3.10