Creating New Documents, Windows, and Views
Home | Overview | How Do I | Sample | Tutorial
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.
Sequence in Creating a Document
Sequence in Creating a Frame Window
Sequence in Creating a View
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 Class 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 Class Library Reference.
What do you want to know more about?
'MFC' 카테고리의 다른 글
클래스 멤버함수를 윈도우 프로시저로 사용하기 [1/3] (1) | 2008.09.01 |
---|---|
MFC 메인 윈도우의 생성 흐름 (1) | 2008.09.01 |
MFC 팁들 (0) | 2008.09.01 |
CWnd::Create 과정.... (1) | 2008.09.01 |
MFC HandlingWindowMessages (1) | 2008.09.01 |
MFC Module State Implementation (0) | 2008.09.01 |
MFC - DLL에대한 정리 (0) | 2008.09.01 |