Using the Undoing/Redoing Capabilities

Start with the project you created in Dealing with the Paint Automation Toolbar.

1.

Add the following menu structure to the main menu you created in Implementing the Paint Automation Initializing, Creating and Freeing

&Edit
&Undo         with ID = IDM_EDIT_UNDO
&Redo         with ID = IDM_EDIT_REDO

2.

Add the following declaration to the WndProc function:

L_BOOL fState ; 
 

 

3.

Add the following lines to the WndProc function after the "return 0L ;" of the case IDM_EXIT in WM_COMMAND message:

 

      case IDM_EDIT_UNDO: 
         L_AutCanUndo ( pAutomation, &fState ) ; 
         if ( fState ) 
         {
            L_AutUndo ( pAutomation, 0 ) ; 
         }
         return 0L ; 

      case IDM_EDIT_REDO: 
         
L_AutCanRedo ( pAutomation, &fState ) ; 
         if ( fState ) 
         {
            L_AutRedo ( pAutomation, 0 ) ; 
         }
         return 0L ; 

4.

Compile and run the project by selecting Build->Execute tutorial.exe from the menu.