IOleObject::SetColorScheme method

Specifies the color palette that the object application should use when it edits the specified object.


HRESULT SetColorScheme(
  [in] LOGPALETTE *pLogpal


pLogpal [in]

Pointer to a LOGPALETTE structure that specifies the recommended palette.

Return value

This method returns S_OK on success. Other possible return values include the following.

Return codeDescription

Object does not support setting palettes.


Invalid LOGPALETTE structure pointed to by pLogPal.


Object must be running to perform this operation.


Notes to Implementers

Upon receiving the palette, the object application should:

  1. Allocate and fill in its own LOGPALETTE structure with the colors specified in the container application's LOGPALETTE structure.
  2. Call CreatePalette to create a palette from the resulting LOGPALETTE structure. This palette can be used to render objects and color menus as the user edits objects in the document.

The first palette entry in the LOGPALETTE structure specifies the foreground color recommended by the container. The second palette entry specifies the recommended background color. The first half of the remaining palette entries are fill colors and the second half are colors for the lines and text.

Container applications typically specify an even number of palette entries. If a container specifies an odd number of entries, the object application should assume that the first half of the total entries plus one designate fill colors, while the remainder designate line and text colors. For example, if there are five entries, the first three should be interpreted as fill colors and the last two as line and text colors.


The IOleObject::SetColorScheme method sends the container application's recommended color palette to the object application, which is not obliged to use it.


Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]






IID_IOleObject is defined as 00000112-0000-0000-C000-000000000046

See also