IOleUndoManager::DiscardFrom

Instructs the undo manager to discard the specified undo unit and all undo units below it on the undo or redo stack.

HRESULT DiscardFrom(
  IOleUndoUnit* pUU   //Pointer to undo unit to be discarded
);
 

Parameters

pUU
[in] Pointer to undo unit to be discarded. This parameter can be NULL to discard the entire undo or redo stack.

Return Values

S_OK
The specified undo unit was successfully discarded.
E_INVALIDARG
The specified undo unit was not found in the stacks.
E_UNEXPECTED
The undo manager is disabled.

Remarks

The undo manager first searches the undo stack for the given unit, and if not found there searches the redo stack. Once found, the given unit and all below it on the same stack are discarded. The undo unit may be a child of a parent unit contained by the undo manager, as determined by calling IOleParentUndoUnit::FindUnit. If it is a child unit, then the root unit containing the given unit and all units below it on the appropriate stack are discarded.

If there is an open parent unit and DiscardFrom(NULL) is called, the undo manager should immediately release and discard the open parent unit without calling the Close method first. When the object that opened the parent unit attempts to close it, IOleUndoManager::Close will return S_FALSE. If pUU is not NULL, then any open parent units should be left open.

QuickInfo

  Windows NT: Use version 4.0 or later. New for OC96.
  Windows: Use Windows 95 or later. New for OC96.
  Windows CE: Unsupported.
  Header: Declared in ocidl.h.

See Also

IOleParentUndoUnit::FindUnit, IOleUndoManager::Close