CDocTemplate

CDocTemplate is an abstract base class that defines the basic functionality for document templates. You usually create one or more document templates in the implementation of your application’s InitInstance function. A document template defines the relationships among three types of classes:

Your application has one document template for each type of document that it supports. For example, if your application supports both spreadsheets and text documents, the application has two document template objects. Each document template is responsible for creating and managing all the documents of its type.

The document template stores pointers to the CRuntimeClass objects for the document, view, and frame window classes. These CRuntimeClass objects are specified when constructing a document template.

The document template contains the ID of the resources used with the document type (such as menu, icon, or accelerator table resources). The document template also has strings containing additional information about its document type. These include the name of the document type (for example, “Worksheet”) and the file extension (for example, “.xls”). Optionally, it can contain other strings used by the application’s user interface, the Windows File Manager, and Object Linking and Embedding (OLE) support.

If your application is an OLE container and/or server, the document template also defines the ID of the menu used during in-place activation. If your application is an OLE server, the document template defines the ID of the toolbar and menu used during in-place activation. You specify these additional OLE resources by calling SetContainerInfo and SetServerInfo.

Because CDocTemplate is an abstract class, you cannot use the class directly. A typical application uses one of the two CDocTemplate-derived classes provided by the Microsoft Foundation Class Library: CSingleDocTemplate, which implements SDI, and CMultiDocTemplate, which implements MDI. See those classes for more information on using document templates.

If your application requires a user-interface paradigm that is fundamentally different from SDI or MDI, you can derive your own class from CDocTemplate.

For more information on CDocTemplate, see Document Templates and the Document/View Creation Process in Visual C++ Programmer's Guide.

include# <afxwin.h>

Class MembersBase ClassHierarchy Chart

Sample   MFC Sample CHKBOOK

See Also   CSingleDocTemplate, CMultiDocTemplate, CDocument, CView, CScrollView, CEditView, CFormView, CFrameWnd, CMDIChildWnd