IOleCacheControl::OnRun method (oleidl.h)

Notifies the cache that the data source object has entered the running state so that the cache object can establish advise sinks as needed.

Syntax

HRESULT OnRun(
  [in] LPDATAOBJECT pDataObject
);

Parameters

[in] pDataObject

A pointer to the IDataObject interface on the object that is entering the running state.

Return value

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

Return code Description
E_INVALIDARG
One of the arguments is not valid.
E_UNEXPECTED
An unexpected error has occurred.
E_OUTOFMEMORY
Insufficient memory is available for this operation.

Remarks

When OnRun is called, the cache sets up advisory connections as necessary with the source data object so it can receive notifications. The advisory connection created between the running object and the cache is destroyed when IOleCacheControl::OnStop is called.

Some object handlers or in-process servers might use the cache passively, and not call OnRun. These applications must call IOleCache2::UpdateCache, IOleCache::InitCache, or IOleCache::SetData to fill the cache when necessary to ensure that the cache gets updated.

OnRun does not add a reference count on the pointer to IDataObject passed in pDataObject. Because it is the responsibility of the caller of OleRun to ensure that the lifetime of the pDataObject pointer lasts until OnStop is called, the caller must be holding a pointer to IDataObject on the data object of interest.

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 oleidl.h

See also

IOleCache2::UpdateCache

IOleCacheControl

IOleCacheControl::OnStop