Undo Example VC++

This example illustrates how to enable Undo functionality in an application.

BOOL CImgEdit1Dlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    blnIsRectangle = FALSE;
    // UndoLevels must be set at form load to allocate undo buffers
    ImgEdit1.SetUndoLevels(1);

    return TRUE;  // return TRUE  unless you set the focus to a control
}
void CImgEdit1Dlg::OnUndo() 
{
    // The Undo method will undo the last imaging operation
    // performed.
    
    VARIANT evt; V_VT(&evt) = VT_ERROR;   // set to default
    ImgEdit1.Undo(evt);
}