IOleObjectImpl

template< class T >
class IOleObjectImpl

Parameters

T Your class, derived from IOleObjectImpl.

The IOleObject interface is the principle interface through which a container communicates with a controlonality to its container. Class IOleObjectImpl provides a default implementation of this interface and implements IUnknown by sending information to the dump device in debug builds.

Related Articles ATL Tutorial, Creating an ATL Project

#include <atlctl.h>

See Also CComControl, ActiveX Controls Interfaces in the Win32 SDK


IOleObjectImpl Class Members

IOleObject Methods
AdviseEstablishes an advisory connection with the control.
CloseChanges the control state from running to loaded.
DoVerbTells the control to perform one of its enumerated actions.
EnumAdviseEnumerates the control's advisory connections.
EnumVerbsEnumerates actions for the control.
GetClientSiteRetrieves the control's client site.
GetClipboardDataRetrieves data from the Clipboard. The ATL implementation returns E_NOTIMPL.
GetExtentRetrieves the extent of the control's display area.
GetMiscStatusRetrieves the status of the control.
GetMonikerRetrieves the control's moniker. The ATL implementation returns E_NOTIMPL.
GetUserClassIDRetrieves the control's class identifier.
GetUserTypeRetrieves the control's user-type name.
InitFromDataInitializes the control from selected data. The ATL implementation returns E_NOTIMPL.
IsUpToDateChecks if the control is up to date. The ATL implementation returns S_OK.
SetClientSiteTells the control about its client site in the container.
SetColorSchemeRecommends a color scheme to the control's application, if any. The ATL implementation returns E_NOTIMPL.
SetExtentSets the extent of the control's display area.
SetHostNamesTells the control the names of the container application and container document.
SetMonikerTells the control what its moniker is. The ATL implementation returns E_NOTIMPL.
UnadviseDestroys an advisory connection with the control.
UpdateUpdates the control. The ATL implementation returns S_OK.
DoVerb Helper Methods
DoVerbDiscardUndoTells the control to discard any undo state it is maintaining.
DoVerbHideTells the control to remove its user interface from view.
DoVerbInPlaceActivateRuns the control and intalls its window, but does not install the control's user interface.
DoVerbOpenCauses the control to be open-edited in a separate window.
DoVerbPrimaryPerforms the specified action when the user double-clicks the control. The control defines the action, usually to activate the control in-place.
DoVerbShowShows a newly inserted control to the user.
DoVerbUIActivateActivates the control in-place and shows the control's user interface, such as menus and toolbars.

IOleObjectImpl Overview


Methods


IOleObjectImpl::Advise

HRESULT Advise( IAdviseSink* pAdvSink, DWORD* pdwConnection );

See IOleObject::Advise in the Win32 SDK.

Remarks

If successful, the IAdviseSink pointer is stored in the control class's m_spOleAdviseHolder data member.

IOleObjectImpl Overview | Class Members

See Also CComControl::m_spOleAdviseHolder, IOleObjectImpl::Unadvise


IOleObjectImpl::Close

HRESULT Close( DWORD dwSaveOption );

See IOleObject::Close in the Win32 SDK.

Remarks

Changes the control from the running to the loaded state. Deactivates the control and destroys the control window if it exists. If the control class data member m_bRequiresSave is TRUE and the dwSaveOption parameter is either OLECLOSE_SAVEIFDIRTY or OLECLOSE_PROMPTSAVE, the control properties are saved before closing.

The pointers held in the control class data members m_spInPlaceSite and m_spAdviseSink are released, and the data members m_bNegotiatedWnd, m_bWndless, and m_bInPlaceSiteEx are set to FALSE.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::DoVerb

HRESULT DoVerb( LONG iVerb, LPMSG lpmsg, IOleClientSite* pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect );

See IOleObject::DoVerb in the Win32 SDK.

Remarks

The ATL implementation of this function uses only the first parameter, iVerb. Depending on the value of iVerb, one of the ATL DoVerb helper functions is called as follows:

iVerb ValueDoVerb helper function called
OLEIVERB_DISCARDUNDOSTATEDoVerbDiscardUndo
OLEIVERB_HIDEDoVerbHide
OLEIVERB_INPLACEACTIVATEDoVerbInPlaceActivate
OLEIVERB_OPENDoVerbOpen
OLEIVERB_PRIMARYDoVerbPrimary
OLEIVERB_PROPERTIESCComControl::DoVerbProperties
OLEIVERB_SHOWDoVerbShow
OLEIVERB_UIACTIVATEDoVerbUIActivate

IOleObjectImpl Overview | Class Members

See Also IOleObject::EnumVerbs in the Win32 SDK.


IOleObjectImpl::DoVerbDiscardUndo

HRESULT DoVerbDiscardUndo( LPCRECT prcPosRect, HWND hwndParent );

Return Value

Returns S_OK.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control.

Remarks

The default implementation simply returns S_OK.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::DoVerbHide

HRESULT DoVerbHide( LPCRECT prcPosRect, HWND hwndParent );

Return Value

Returns S_OK.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control. Not used in the ATL implementation.

Remarks

Deactivates and removes the control's user interface, and hides the control.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::DoVerbShow


IOleObjectImpl::DoVerbInPlaceActivate

HRESULT DoVerbInPlaceActivate( LPCRECT prcPosRect, HWND hwndParent );

Return Value

One of the standard HRESULT values.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control. Not used in the ATL implementation.

Remarks

Activates the control in place by calling CComControl::InPlaceActivate. Unless the control class's data member m_bWindowOnly is TRUE, DoVerbInPlaceActivate first attempts to activate the control as a windowless control (possible only if the container supports IOleInPlaceSiteWindowless). If that fails, the function attempts to activate the control with extended features (possible only if the container supports IOleInPlaceSiteEx). If that fails, the function attempts to activate the control with no extended features (possible only if the container supports IOleInPlaceSite). If activation succeeds, the function notifies the container the control has been activated.

IOleObjectImpl Overview | Class Members

See Also CComControl::InPlaceActivate, CComControl::m_bWindowOnly


IOleObjectImpl::DoVerbOpen

HRESULT DoVerbOpen( LPCRECT prcPosRect, HWND hwndParent );

Return Value

Returns S_OK.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control.

Remarks

The default implementation simply returns S_OK.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::DoVerbPrimary

HRESULT DoVerbPrimary( LPCRECT prcPosRect, HWND hwndParent );

Return Value

One of the standard HRESULT values.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control.

Remarks

Defines the action taken when the user double-clicks the control. By default, set to display the property pages. You can override this in your control class to invoke a different behavior on double-click; for example, play a video or go in-place active.

IOleObjectImpl Overview | Class Members

See Also CComControl::DoVerbProperties


IOleObjectImpl::DoVerbShow

HRESULT DoVerbShow( LPCRECT prcPosRect, HWND hwndParent );

Return Value

One of the standard HRESULT values.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control. Not used in the ATL implementation.

Remarks

Tells the container to make the control visible.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::DoVerbHide


IOleObjectImpl::DoVerbUIActivate

HRESULT DoVerbUIActivate( LPCRECT prcPosRect, HWND hwndParent );

Return Value

One of the standard HRESULT values.

Parameters

prcPosRec [in] Pointer to the rectangle the container wants the control to draw into.

hwndParent [in] Handle of the window containing the control. Not used in the ATL implementation.

Remarks

Activates the control's user interface and notifies the container that its menus are being replaced by composite menus.

IOleObjectImpl Overview | Class Members

See Also CComControl::InPlaceActivate, IOleObjectImpl::DoVerbInPlaceActivate


IOleObjectImpl::EnumAdvise

HRESULT EnumAdvise( IEnumSTATDATA** ppenumAdvise );

See IOleObject::EnumAdvise in the Win32 SDK.

Remarks

Supplies an enumeration of registered advisory connections for this control.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::EnumVerbs


IOleObjectImpl::EnumVerbs

HRESULT EnumVerbs( IEnumOLEVERB** ppEnumOleVerb );

See IOleObject::EnumVerbs in the Win32 SDK.

Remarks

Supplies an enumeration of registered actions (verbs) for this control by calling OleRegEnumVerbs. You can add verbs to your projects .rgs file. For example, see CircCtl.rgs in the CIRC sample.

IOleObjectImpl Overview | Class Members

See Also OleRegEnumVerbs in theWin32 SDK, IOleObjectImpl::EnumAdvise


IOleObjectImpl::GetClientSite

HRESULT GetClientSite( IOleClientSite** ppClientSite );

See IOleObject::GetClientSite in the Win32 SDK.

Remarks

Puts the pointer in the control class data member m_spClientSite into ppClientSite and increments the reference count on the pointer.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::SetClientSite


IOleObjectImpl::GetClipboardData

HRESULT GetClipboardData( DWORD dwReserved, IData Object** ppDataObject );

See IOleObject::GetClipboardData in the Win32 SDK.

Remarks

Returns E_NOTIMPL.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::GetExtent

HRESULT GetExtent( DWORD dwDrawAspect, SIZEL* psizel );

See IOleObject::GetExtent in the Win32 SDK.

Remarks

Retrieves a running control's display size in HIMETRIC units (0.01 millimeter per unit). The size is stored in the control class data member m_sizeExtent.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::SetExtent


IOleObjectImpl::GetMiscStatus

HRESULT GetMiscStatus( DWORD dwAspect, DWORD* pdwStatus );

See IOleObject::GetMiscStatus in the Win32 SDK.

Remarks

Returns a pointer to registered status information for the control by calling OleRegGetMiscStatus. The status information includes behaviors supported by the control and presentation data. You can add status information to your project's .rgs file.

IOleObjectImpl Overview | Class Members

See Also OleRegGetMiscStatus in the Win32 SDK , IOleObjectImpl::EnumVerbs, IOleObjectImpl::GetUserType


IOleObjectImpl::GetMoniker

HRESULT GetMoniker( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker** ppmk );

See IOleObject::GetMoniker in the Win32 SDK.

Remarks

Returns E_NOTIMPL.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::GetUserClassID

HRESULT GetUserClassID( CLSID* pClsid );

See IOleObject::GetUserClassID in the Win32 SDK.

Remarks

Returns the control's class identifier.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::GetUserType


IOleObjectImpl::GetUserType

HRESULT GetUserType( DWORD dwFormOfType, LPOLESTR* pszUserType );

See IOleObject::GetUserType in the Win32 SDK.

Remarks

Returns the control's user-type name by calling OleRegGetUserType. The user-type name is used for display in user-interfaces elements such as menus and dialog boxes. You can change the user-type name in your project's .rgs file.

IOleObjectImpl Overview | Class Members

See Also OleRegGetUserType in the Win32 SDK, IOleObjectImpl::GetUserClassID, IOleObjectImpl::GetMiscStatus, IOleObjectImpl::EnumVerbs


IOleObjectImpl::InitFromData

HRESULT InitFromData( IDataObject* pDataObject, BOOL fCreation, DWORD dwReserved );

See IOleObject::InitFromData in the Win32 SDK.

Remarks

Returns E_NOTIMPL.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::IsUpToDate

HRESULT IsUpToDate( );

See IOleObject::IsUpToDate in the Win32 SDK.

Remarks

Returns S_OK.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::SetClientSite

HRESULT SetClientSite( IOleClientSite* pClientSite );

See IOleObject::SetClientSite in the Win32 SDK.

Remarks

Uses pClientSite as the pointer to the control's client site and stores pClientSite in the control class data member m_spClientSite. The method then returns S_OK.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::GetClientSite


IOleObjectImpl::SetColorScheme

HRESULT SetColorScheme( LOGPALETTE* pLogPal );

See IOleObject::SetColorScheme in the Win32 SDK.

Remarks

Returns E_NOTIMPL.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::SetExtent

HRESULT SetExtent( DWORD dwDrawAspect, SIZEL* psizel );

See IOleObject::SetExtent in the Win32 SDK.

Remarks

If the control class data member m_bAutoSize is TRUE, this method returns E_FAIL because the control cannot be resized. Otherwise, SetExtent stores the value pointed to by psizel in the control class data member m_sizeExtent. This value is in HIMETRIC units (0.01 millimeter per unit).

If the control class data member m_bResizeNatural is TRUE, SetExtent also stores the value pointed to by psizel in the control class data member m_sizeNatural.

If the control class data member m_bRecomposeOnResize is TRUE, SetExtent calls SendOnDataChange and SendOnViewChange to notify all advisory sinks registered with the advise holder that the control size has changed.

IOleObjectImpl Overview | Class Members

See Also IOleObjectImpl::GetExtent, CComControl::SendOnDataChange, CComControl::SendOnViewChange


IOleObjectImpl::SetHostNames

HRESULT SetHostNames( LPCOLESTR szContainerApp, LPCOLESTR szContainerObj );

See IOleObject::SetHostNames in the Win32 SDK.

Remarks

Returns S_OK.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::SetMoniker

HRESULT SetMoniker( DWORD dwAssign, DWORD dwWhichMoniker, IMoniker** ppmk );

See IOleObject::SetMoniker in the Win32 SDK.

Remarks

Returns E_NOTIMPL.

IOleObjectImpl Overview | Class Members


IOleObjectImpl::Unadvise

HRESULT Unadvise( DWORD dwConnection );

See IOleObject::Unadvise in the Win32 SDK.

Remarks

Deletes the advisory connection stored in the control class's m_spOleAdviseHolder data member.

IOleObjectImpl Overview | Class Members

See Also CComControl::m_spOleAdviseHolder, IOleObjectImpl::Advise


IOleObjectImpl::Update

HRESULT Update( );

See IOleObject::Update in the Win32 SDK.

Remarks

Returns S_OK.

IOleObjectImpl Overview | Class Members