OleSetContainedObject function (ole2.h)

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.

Syntax

HRESULT OleSetContainedObject(
  [in] LPUNKNOWN pUnknown,
  [in] BOOL      fContained
);

Parameters

[in] pUnknown

Pointer to the IUnknown interface of the object.

[in] fContained

TRUE if the object is an embedded object; FALSE otherwise.

Return value

This function returns S_OK on success. Other possible values include the following.

Return code Description
E_OUTOFMEMORY
Insufficient memory for the operation.
E_INVALIDARG
One or more parameters are invalid.
E_UNEXPECTED
An unexpected error occurred.

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.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ole2.h
Library Ole32.lib
DLL Ole32.dll
API set ext-ms-win-com-ole32-l1-1-2 (introduced in Windows 10, version 10.0.10240)

See also

IRunnableObject::SetContainedObject