OleSetContainedObject

Notifies an object that it is embedded in an OLE container, which ensures that reference counting is done correctly for containers that support links to embedded objects.

WINOLEAPI OleSetContainedObject(
  LPUNKNOWN pUnk,  //Pointer to the interface on the embedded object
  BOOL fContained  //Indicates if the object is embedded
);
 

Parameters

pUnk
[in] Pointer to the IUnknown interface of the object.
fContained
[in] TRUE if the object is an embedded object; FALSE otherwise.

Return Values

This function supports the standard return values E_INVALIDARG, E_OUTOFMEMORY and E_UNEXPECTED, as well as the following:

S_OK
The object was notified successfully.

Remarks

The OleSetContainedObject function notifies an object that it is embedded in an OLE container. The implementation of OleSetContainedObject was changed in OLE 2.01 to coincide with the publication of the IRunnableObject interface. You can use OleSetContainedObject and the IRunnableObject::SetContainedObject method interchangeably. The OleSetContainedObject function queries the object for a pointer to the IRunnableObject interface. If successful, the function returns the results of calling IRunnableObject::SetContainedObject.

Note  The implementation of OleSetContainedObject in earlier versions of OLE differs from that described here.

Windows CE: Passing into this function any invalid and, under some circumstances, NULL pointers will result in unexpected termination of the application. For more information about handling exceptions, see Programming Considerations.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Use version 2.0 or later.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

IRunnableObject::SetContainedObject