Default Handler IOleObject Behavior

Only two member functions in IOleObject always attempt to run the local server and delegate the call: DoVerb and Update. All others either have minimal implementations or simply return an HRESULT, as shown in Table 19-1. Also, the default handler saves the information from Advise, Unadvise, EnumAdvise, SetClientSite, GetClientSite, and SetHostNames so that if and when it launches a local server, it can forward that information. When the server is running, all of these functions are delegated to the running object.

Member Function

Action

Advise

Calls CreateOleAdviseHolder if an advise holder has not yet been created. In either case, delegates to IOleAdviseHolder::Advise.

Close

Meaningless without a running server, so it returns NOERROR.

DoVerb*

Runs and delegates to the server.

EnumAdvise

Delegates to IOleAdviseHolder.

EnumVerbs

Delegates to OleRegEnumVerbs and returns.

GetClientSite

Returns the last IOleClientSite seen in SetClientSite and NOERROR.

GetClipboardData

Returns OLE_E_NOTRUNNING.

GetExtent

Attempts to locate the requested aspect in the cache and returns the size of that presentation if available.

GetMiscStatus

Delegates to OleRegGetMiscStatus.

GetMoniker

Calls IOleClientSite::GetMoniker if SetClientSite has been called with a valid IOleClientSite pointer. Otherwise, returns E_UNSPEC.

GetUserClassID

Returns the CLSID passed to OleCreateDefaultHandler, mapped to a new CLSID if emulation is active, and NOERROR.

GetUserType

Delegates to OleRegGetUserType.

InitFromData

Returns OLE_E_NOTRUNNING.

IsUpToDate

Returns OLE_E_NOTRUNNING.

SetClientSite

Saves the IOleClientSite pointer in an internal variable and returns NOERROR.

SetColorScheme

Returns OLE_E_NOTRUNNING.

SetExtent

Returns OLE_E_NOTRUNNING.

SetHostNames

Stores the strings in atoms and returns NOERROR.

SetMoniker

Returns NOERROR.

Unadvise

Delegates to IOleAdviseHolder.

Update*

Runs the server and delegates to it.


Table 19-1

Behavior of the default handler's IOleObject interface for a non-running object.

* Launches the local server