provided by: 
Originally published at Internet.comINSTRUCTIONS
These are the steps used in the project file to add multi-level undo/redo capability to the Scribble application.
Copy Files
* Copy scribble tutorial files (I used step 3) into new folder. * Copy "command" and "ref object" files into the folder and add them to the project. You could also put them in a library which would be more convenient. These files are: Command.h Command.cpp CommandHistory.h CommandHistory.cpp RefObject.h RefObject.cpp * Add includes for RefObject.h, Command.h, and CommandHistory.h to stdafx.h
Edit Resources * Add undo/redo buttons to the IDR_MAINFRAME toolbar. Make sure their id's are ID_EDIT_UNDO and ID_EDIT_REDO (there are string table entries for both in MFC). You can grab the images from this project. * Add "&Redo" to the IDR_SCRIBBTYPE edit menu and use ID_EDIT_REDO command id.
CStroke Changes * Derive CStroke from CRefObject instead of CObject * Change CStroke's IMPLEMENT_SERIAL macro to use new base class * Under "Operations" add GetBoundingRect declaration to CStroke: CRect GetBoundingRect() const; * Add CStroke::GetBoundingRect definition to ScribDoc.cpp * Immediately after class definition, add CStrokeList typedef for easy use: typedef CTypedRefObList< CStroke* > CStrokeList; ...
Read article at Internet.com site