Share via


IOleClientSite::GetContainer

This method requests a pointer to an object's container.

HRESEUT GetContainer( 
  LPOLECONTAINTER FAR* ppContainer
);

Parameters

  • ppContainer
    [out] Address of IOleContainer* pointer variable that receives the interface pointer to the container object. If an error occurs, the implementation must set *ppContainer to NULL.

Return Values

One of the values described in the following table is returned.

Value Description
S_OK The pointer to the container's IOleContainer interface was successfully returned.
OLE_E_NOT_SUPPORTED Client site is in OLE 1 container.
E_NOINTERFACE The container does not implement the IOleContainer interface.

Remarks

If a container supports links to its embedded objects, implementing GetContainer enables link clients to enumerate the container's objects and recursively traverse a containment hierarchy. This method is optional but recommended for all containers that expect to support links to their embedded objects.

Link clients can traverse a hierarchy of compound-document objects by recursively calling GetContainer to get a pointer to the link source's container; followed by IOleContainer::QueryInterface to get a pointer to the container's IOleObject interface and, finally, IOleObject::GetClientSite to get the container's client site in its container.

Simple containers that do not support links to their embedded objects probably do not need to implement this method. Instead, they can return E_NOINTERFACE and set ppContainer to NULL.

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

OS Versions: Windows CE 2.0 and later.
Header: Oleidl.h, Oleidl.idl.
Link Library: Oleaut32.lib, Uuid.lib.

See Also

IOleClientSite | Determining Supported COM APIs | IOleObject | IOleObject::GetClientSite

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.