An Multiple Document Interface (MDI) application is an application which
can have multiple documents and views opened at the same time. It has an MDI
frame window, which occupies the entire client area of the mainframe window and
it holds and manages its child windows. The MDI frame window is derived from the
class CMDIFrameWnd, which in turn is derived from CFrameWnd. Each
child window is created as an MDI child frame and is derived from the MFC class
CMDIChildWnd, where as the Class CMDIChildWnd is also derived from
CFrameWnd. The MDI child frame is to holds the view, which can also hold a
splitter window will manage the multiple views in the child window.
In the document-view architecture, a message map can be located in any of the
classes. The command message routing for WM_COMMAND messages follows
basically the same sequence as for the SDI application, except that we now have
an MDI child frame window between the view and the mainframe window. A command
message can go to any of the five classes in the following order: the view, the
document, the MDI child frame, the mainframe, and the application. The
WM_COMMAND message is routed until the first handler function is encountered,
which is then executed, and any further routing of the message is terminated.
The application object maintains the list of its document templates and the
document template has a list of its open documents. The MDI frame window keeps
track of all its child windows and knows which one is the active window. Each
MDI child window holds a view and each view is attached to a document and each
document has a list of its views and a pointer to its document template.
|