IOleUndoUnit interface (ocidl.h)

Serves as the main interface on an undo unit. An undo unit encapsulates the information necessary to undo or redo a single action.

When an object's state changes and it needs to create an undo unit, it first needs to know what parent units are open. It calls the IOleUndoManager::GetOpenParentState method to determine this. If the call returns S_FALSE, then there is no enabling parent. If the call returns S_OK but the UAS_NOPARENTENABLE flag is set, then the open parent is a disabling parent. In either of these cases, the object calls IOleUndoManager::DiscardFrom(NULL) on the undo manager and skips creating the undo unit.

If the method returns S_OK, but the UAS_BLOCKED flag is set, then the open parent is a blocking parent. The object does not need to create an undo unit, since it would be immediately discarded. If the return value is S_OK and neither of the bit flags are set, then the object creates the undo unit and calls IOleUndoManager::Add on the undo manager.

The object should retain a pointer to the undo manager.

Inheritance

The IOleUndoUnit interface inherits from the IUnknown interface. IOleUndoUnit also has these types of members:

Methods

The IOleUndoUnit interface has these methods.

 
IOleUndoUnit::Do

Instructs the undo unit to carry out its action. Note that if it contains child undo units, it must call their Do methods as well.
IOleUndoUnit::GetDescription

Retrieves a description of the undo unit that can be used in the undo or redo user interface.
IOleUndoUnit::GetUnitType

Retrieves the CLSID and a type identifier for the undo unit.
IOleUndoUnit::OnNextAdd

Notifies the last undo unit in the collection that a new unit has been added.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header ocidl.h

See also

IOleParentUndoUnit

IOleUndoManager