Partager via


IOleObject (Compact 2013)

3/26/2014

This interface is the principal means by which an embedded object provides basic functionality to and communicates with its container.

When to Implement

An object application must implement this interface, along with at least IDataObject and IPersistStorage, for each type of embedded object that it supports.

Although this interface contains 21 methods, only three are nontrivial to implement and must be fully implemented:

Six methods provide optional functionality, which, if not desired, can be implemented to return E_NOTIMPL:

When to Use

Call the methods of this interface to enable a container to communicate with an embedded object.

A container must call the following:

  • DoVerb to activate an embedded object
  • SetHostNames to communicate the names of the container application and container document
  • Close to move an object from a running to a loaded state

Calls to all other methods are optional.

Methods

The following table shows the methods for this interface in alphabetical order. Like all COM interfaces, this interface inherits the methods for the IUnknown interface.

Method

Description

IOleObject::Advise

This method establishes an advisory connection between an OLE object and the calling object's advise sink, through which the calling object receives notification when the compound document object is renamed, save, or closed.

IOleObject::Close

This method changes an embedded object from the running to the loaded state.

It also disconnects a linked object from its link source.

IOleObject::DoVerb

This method requests an object to perform an action in response to a user's action.

IOleObject::EnumAdvise

This method retrieves a pointer to an enumerator that can be used to enumerate the advisory connections registered for an object, so a container knows what to release prior to closing down.

IOleObject::EnumVerbs

This method exposes a pull-down menu listing the verbs available for an object in ascending order by verb number.

IOleObject::GetClientSite

This method obtains a pointer to an embedded object's client site.

IOleObject::GetClipboardData

This method retrieves a data object that contains the current contents of the embedded object on which this method is called.

Using the pointer to this data object, it is possible to create an embedded object with the same data as the original.

IOleObject::GetExtent

This method retrieves a running object's current display size.

IOleObject::GetMiscStatus

This method returns a value that indicates the status of an object at creation and loading.

IOleObject::GetMoniker

This method retrieves an embedded object's moniker, which the caller can use to link to the object.

IOleObject::GetUserClassID

This method returns the object class identifier (CLSID) corresponding to the string identifying the object to an end-user.

IOleObject::GetUserType

This method retrieves the user type name of an object for display in user interface elements such as menus, list boxes, and dialog boxes.

IOleObject::InitFromData

This method initializes a newly created object with data from a specified data object, which can reside either in the same container or on the clipboard.

IOleObject::IsUpToDate

This method checks recursively whether or not an object is current.

IOleObject::SetClientSite

This method informs an embedded object of its display location, called a "client site", within its container.

IOleObject::SetColorScheme

This method specifies the color palette that the object application should use when it edits the specified object.

IOleObject::SetExtent

This method informs an object of how much display space its container has assigned it.

IOleObject::SetHostNames

This method provides an object with the name of its container application and the compound document in which it is embedded.

IOleObject::SetMoniker

This method notifies an object of its container's moniker, the object's own moniker relative to the container, or the object's full moniker.

IOleObject::Unadvise

This method deletes a previously established advisory connection.

IOleObject::Update

This method updates an object handler's or link object's data to view caches.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header

Oleidl.h,
oleidl.idl

Library

oleaut32.lib,
uuid.lib

See Also

Reference

OLE Interfaces
IDataObject
IPersistStorage
IUnknown