Returns the logical palette that the object will use for drawing in its IViewObject::Draw method with the corresponding parameters.
HRESULT GetColorSet(
DWORD dwAspect, //How the object is to be represented
LONG lindex, //Part of the object of interest in the draw
//operation
void * pvAspect, //Always NULL
DVTARGETDEVICE * ptd,
//Pointer to target device in a structure
HDC hicTargetDev, //Information context for the target device
LOGPALETTE ** ppColorSet
//Address of output variable that receives a
//pointer to the requested LOGPALETTE structure
);
This method supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:
The IViewObject::GetColorSet method recursively queries any nested objects and returns a color set that represents the union of all colors requested. The color set eventually percolates to the top-level container that owns the window frame. This container can call IViewObject::GetColorSet on each of its embedded objects to obtain all the colors needed to draw the embedded objects. The container can use the color sets obtained in conjunction with other colors it needs for itself to set the overall color palette.
The OLE-provided implementation of IViewObject::GetColorSet looks at the data it has on hand to draw the picture. If CF_DIB is the drawing format, the palette found in the bitmap is used. For a regular bitmap, no color information is returned. If the drawing format is a metafile, the object handler enumerates the metafile looking for a CreatePalette metafile record. If one is found, the handler uses it as the color set.
Object applications that rely on the default handler for drawing and that use metafiles for doing so should provide a SetPaletteEntries record when they generate their metafiles. If a SetPaletteEntries record is not found, the default object handler returns S_FALSE.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in oleidl.h.