# IOleCacheControl::OnRun

Notifies the cache that the data source object has now entered its running state.

HRESULT OnRun(

DATAOBJECT * pDataObject | //Pointer to the object that is now running
); |

Parameter

pDataObject
  [in] Pointer to the IDataObject interface on the object that is entering the running state.

Return Values

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

S_OK
  The cache was notified and pDataObject is valid.

Remarks

When IOleCacheControl::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 IOleCacheControl::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.

IOleCacheControl::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.

See Also

IOleCache2::UpdateCache, IOleCacheControl::OnStop