다음을 통해 공유


새 문서, 창 및 뷰 만들기

The following figures give an overview of the creation process for documents, views, and frame windows. Other articles that focus on the participating objects provide further details.

Upon completion of this process, the cooperating objects exist and store pointers to each other. The following figures show the sequence in which objects are created. You can follow the sequence from figure to figure.

문서를 만드는 순서

문서 만들기 시퀀스

프레임 창을 만드는 순서

프레임 창 만들기 시퀀스

뷰를 만드는 순서

뷰 만들기 시퀀스

For information about how the framework initializes the new document, view, and frame-window objects, see classes CDocument, CView, CFrameWnd, CMDIFrameWnd, and CMDIChildWnd in the MFC Library Reference. Also see Technical Note 22, which explains the creation and initialization processes further under its discussion of the framework's standard commands for the New and Open items on the File menu.

Initializing Your Own Additions to These Classes

The preceding figures also suggest the points at which you can override member functions to initialize your application's objects. An override of OnInitialUpdate in your view class is the best place to initialize the view. The OnInitialUpdate call occurs immediately after the frame window is created and the view within the frame window is attached to its document. For example, if your view is a scroll view (derived from CScrollView rather than CView), you should set the view size based on the document size in your OnInitialUpdate override. (This process is described in the description of class CScrollView.) You can override the CDocument member functions OnNewDocument and OnOpenDocument to provide application-specific initialization of the document. Typically, you must override both since a document can be created in two ways.

In most cases, your override should call the base class version. For more information, see the named member functions of classes CDocument, CView, CFrameWnd, and CWinApp in the MFC Library Reference.

참고 항목

개념

문서 템플릿 및 문서/뷰 만들기 프로세스

문서 템플릿 만들기

문서/뷰 만들기

MFC 개체 간 관계