Last updated Feb 29th, 1996
This document describes palette interaction between OLE Document Objects and Document Object containers.
In the most common cases, a DocObject container will only activate one DocObject at a time. In such a situation, that activated DocObject should have complete control over the palette which includes managing palette issues for any controls or content within that document.
The DocObject container in this case has nothing to do with palettes and need not be concerned with palette issues. It should leave palette handling up to the DocObject - in other words, it should forward all Windows palette management messages on to the DocObject.
Example code for the window procedure of the Document Object host:
case WM_PALETTECHANGED: case WM_QUERYNEWPALETTE: { HWND hwnd; IOleWindow *pOleWindow; if (pDocObj && SUCCEEDED(pDocObj->QueryInterface(IID_IOleWindow, (LPVOID*)&pOleWindow))) { LRESULT lres = 0; if (SUCCEEDED(pOleWindow->GetWindow(&hwnd))) { lres = SendMessage(hwnd, uMsg, wParam, lParam); } pOleWindow->Release(); return lres; } break; }
In rare cases, a DocObject container may be able to activate more than one DocObject at a time within multiple container frames. While this user interface is discouraged at this time, it is still possible to achieve.
However, no palette-management solution exists for this scenario because there is currently no protocol for communicating palettes between a DocObject and its container. Therefore the container cannot create a palette suitable to all DocObjects that it has activated.
Because of this, the activated DocObject in the foreground has control over the palette and should use foreground palette rendering. Other activated DocObjects in the background use background palette rendering. The DocObject container itself does not participate in palette management at all.