Accessing the Containing Document

Objects that are embedded in a container often require access to that container's programmability interface (for example, its IDispatch implementation). The container should implement its document-level programmabity interface (for example, the Document object) that matches the one used by IOleContainer (either VTBL or IDispatch). To access the containing document, an object can call IOleClientSite::GetContainer, which returns a pointer to IOleContainer, and can then call QueryInterface for the appropriate interface (usually IID_IDispatch).

Embedded objects can also access type information by using VTBL binding to dual interfaces, calling QueryInterface to IOleContainer for IProvideClassInfo.