OleTranslateColor

Converts an OLE_COLOR type to a COLORREF.

STDAPI OleTranslateColor (
  OLE_COLOR clr,       //Color to be converted into a COLORREF
  HPALETTE hpal,       //Palette used for conversion
  COLORREF *pcolorref  //Pointer to the caller's variable that 
                       // receives the converted result
);
 

Parameters

clr
[in] The OLE color to be converted into a COLORREF.
hpal
[in] Palette used as a basis for the conversion.
pcolorref
[out] Pointer to the caller's variable that receives the converted COLORREF result. This can be NULL, indicating that the caller wants only to verify that a converted color exists.

Return Values

This function supports the standard return values E_INVALIDARG and E_UNEXPECTED, as well as the following:

S_OK
The color was translated successfully.

Remarks

The following table describes the color conversion:

OLE_COLOR hPal Resulting COLORREF
invalid Undefined (E_INVALIDARG)
0x800000xx, xx is not a valid Win32 GetSysColor index Undefined (E_INVALIDARG)
invalid Undefined (E_INVALIDARG)
0x0100iiii, iiii is not a valid palette index valid palette Undefined (E_INVALIDARG)
0x800000xx, xx is a valid GetSysColor index NULL 0x00bbggrr
0x0100iiii, iiii is a valid palette index NULL 0x0100iiii
0x02bbggrr (palette relative) NULL 0x02bbggrr
0x00bbggrr NULL 0x00bbggrr
0x800000xx, xx is a valid GetSysColor index valid palette 0x00bbggrr
0x0100iiii, iiii is a valid palette index in hPal valid palette 0x0100iiii
0x02bbggrr (palette relative) valid palette 0x02bbggrr
0x00bbggrr valid palette 0x02bbggrr

QuickInfo

  Windows NT: Use version 4.0 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in olectl.h.
  Import Library: Included as a resource in olepro32.dll.