This documentation is archived and is not being maintained.

CMultiDocTemplate Class

Defines a document template that implements the multiple document interface (MDI).

class CMultiDocTemplate : public CDocTemplate

An MDI application uses the main frame window as a workspace in which the user can open zero or more document frame windows, each of which displays a document. For a more detailed description of the MDI, see Windows Interface Guidelines for Software Design.

A document template defines the relationships among three types of classes:

  • A document class, which you derive from CDocument.

  • A view class, which displays data from the document class listed above. You can derive this class from CView, CScrollView, CFormView, or CEditView. (You can also use CEditView directly.)

  • A frame window class, which contains the view. For an MDI document template, you can derive this class from CMDIChildWnd, or, if you don't need to customize the behavior of the document frame windows, you can use CMDIChildWnd directly without deriving your own class.

An MDI application can support more than one type of document, and documents of different types can be open at the same time. Your application has one document template for each document type that it supports. For example, if your MDI application supports both spreadsheets and text documents, the application has two CMultiDocTemplate objects.

The application uses the document template(s) when the user creates a new document. If the application supports more than one type of document, then the framework gets the names of the supported document types from the document templates and displays them in a list in the File New dialog box. Once the user has selected a document type, the application creates a document class object, a frame window object, and a view object and attaches them to each other.

You do not need to call any member functions of CMultiDocTemplate except the constructor. The framework handles CMultiDocTemplate objects internally.

For more information on CMultiDocTemplate, see Document Templates and the Document/View Creation Process.

Header: afxwin.h