In this task, you will use WizardBar to override OnOpenDocument and DeleteContents, which are needed for Scribble-specific initialization and cleanup.
WizardBar
To display WizardBar
To use WizardBar to override functions
CScribbleDoc
.The New Virtual Override dialog box appears.
OnOpenDocument
. Click Add Handler.ClassWizard creates a starter definition for the function, highlighting the code so you can simply begin typing to override it. (You won’t type anything at this point.)
DeleteContents
. ClassWizard writes the overridden functions to ScribbleDoc.h. Practice using ClassView to jump to and examine the declaration in ScribbleDoc.h.
When you created the starter application, AppWizard added to ScribbleDoc.h the declaration for OnNewDocument
and for Serialize
. Here is the starter function handler code that ClassWizard added to ScribbleDoc.cpp (do not add this code):
BOOL CScribbleDoc::OnOpenDocument(LPCTSTR lpszPathName)
{
if (!CDocument::OnOpenDocument(lpszPathName))
return FALSE;
// TODO: Add your specialized creation code here
return TRUE;
}
void CScribbleDoc::DeleteContents()
{
// TODO: Add your specialized code here and/or call the base class
CDocument::DeleteContents();
}
You will fill in the handler definitions for OnOpenDocument
, OnNewDocument
, and DeleteContents
later, in Initializing and Cleaning Up.