How to: 清除復原堆疊
下列程序的下面將說明如何清除復原堆疊。
若要清除復原堆疊
若要清除復原堆疊使用 IOleUndoManager::DiscardFrom 方法。 以下是一個例子:
HRESULT CCmdWindow::ClearUndoStack() { HRESULT hr = S_OK; if (m_pUndoMgr == NULL) { IfFailGo(m_pTextLines->GetUndoManager(&m_pUndoMgr)); ASSERT(m_pUndoMgr != NULL, "",;); } IfFailGo(m_pUndoMgr->DiscardFrom(NULL)); Error: return hr; }