This method requests a pointer to an objects container.

HRESEUT GetContainer( 


  • 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 containers 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.


If a container supports links to its embedded objects, implementing IOleClientSite::GetContainer enables link clients to enumerate the containers 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 IOleClientSite::GetContainer to get a pointer to the link sources container; followed by IOleContainer::QueryInterface to get a pointer to the containers IOleObject interface and, finally, IOleObject::GetClientSite to get the containers 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.


Runs on Versions Defined in Include Link to
Windows CE OS 2.0 and later Oleidl.h    

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.