This documentation is archived and is not being maintained.


Called by the framework when the user modifies, saves, or closes the OLE item.

virtual void OnChange(
   DWORD dwParam 



The reason the server changed this item. It can have one of the following values:

  • OLE_CHANGED   The OLE item's appearance has changed.

  • OLE_SAVED   The OLE item has been saved.

  • OLE_CLOSED   The OLE item has been closed.

  • OLE_CHANGED_STATE   The OLE item has changed from one state to another.


If nCode is OLE_SAVED or OLE_CLOSED, this parameter is not used. If nCode is OLE_CHANGED, this parameter specifies the aspect of the OLE item that has changed. For possible values, see the dwParam parameter of COleClientItem::Draw. If nCode is OLE_CHANGED_STATE, this parameter is a COleClientItem::ItemState enumerated value and describes the state being entered. It can have one of the following values: emptyState, loadedState, openState, activeState, or activeUIState.

(If the server application is written using the Microsoft Foundation Class Library, this function is called in response to the Notify member functions of COleServerDoc or COleServerItem.) The default implementation marks the container document as modified if nCode is OLE_CHANGED or OLE_SAVED.

For OLE_CHANGED_STATE, the current state returned from GetItemState will still be the old state, meaning the state that was current prior to this state change.

Override this function to respond to changes in the OLE item's state. Typically you update the item's appearance by invalidating the area in which the item is displayed. Call the base class implementation at the beginning of your override.