Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

Syntax

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 * ppContainerto NULL.

Return Value

One of the values in the following table is returned.

Value Description

S_OK

The pointer to the container's IOleContainerinterface was returned.

OLE_E_NOT_SUPPORTED

Client site is in OLE 1 container.

E_NOINTERFACE

The container does not implement the IOleContainerinterface.

Remarks

If a container supports links to its embedded objects, implementing GetContainerenables 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 GetContainerto get a pointer to the link source's container; followed by IOleContainerto get a pointer to the container's IOleObjectinterface and, finally, IOleObject::GetClientSiteto 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 ppContainerto NULL.

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

Requirements

Header Oleidl.h, oleidl.idl
Library oleaut32.lib, uuid.lib
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also