OLE Logo Palette Behaviour for OLE Document Objects

Last updated Feb 29th, 1996

This document describes palette interaction between OLE Document Objects and Document Object containers.


NOTE: THIS DOCUMENT IS AN EARLY RELEASE OF THE FINAL SPECIFICATION. IT IS MEANT TO SPECIFY AND ACCOMPANY SOFTWARE THAT IS STILL IN DEVELOPMENT. SOME OF THE INFORMATION IN THIS DOCUMENTATION MAY BE INACCURATE OR MAY NOT BE AN ACCURATE REPRESENTATION OF THE FUNCTIONALITY OF THE FINAL SPECIFICATION OR SOFTWARE. MICROSOFT ASSUMES NO RESPONSIBILITY FOR ANY DAMAGES THAT MIGHT OCCUR EITHER DIRECTLY OR INDIRECTLY FROM THESE INACCURACIES. MICROSOFT MAY HAVE TRADEMARKS, COPYRIGHTS, PATENTS OR PENDING PATENT APPLICATIONS, OR OTHER INTELLECTUAL PROPERTY RIGHTS COVERING SUBJECT MATTER IN THIS DOCUMENT. THE FURNISHING OF THIS DOCUMENT DOES NOT GIVE YOU A LICENSE TO THESE TRADEMARKS, COPYRIGHTS, PATENTS, OR OTHER INTELLECTUAL PROPERTY RIGHTS.

Single DocObject Case

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;
    }

Multiple DocObject Case

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.