The Main Frame Window and Document Classes

Up to now, you've been using a view window as if it were the application's only window. In an SDI application, the view window sits inside another window—the application's main frame window. The main frame window has the title bar and the menu bar. Various child windows, including the toolbar window, the view window, and the status bar window, occupy the main frame window's client area, as shown in Figure 13-1. The application framework controls the interaction between the frame and the view by routing messages from the frame to the view.

click to view at full size.

Figure 13-1. The child windows within an SDI main frame window.

Look again at any project files generated by AppWizard. The MainFrm.h and MainFrm.cpp files contain the code for the application's main frame window class, derived from the class CFrameWnd. Other files, with names such as ex13aDoc.h and ex13aDoc.cpp, contain code for the application's document class, which is derived from CDocument. In this chapter you'll begin working with the MFC document class. You'll start by learning that each view object has exactly one document object attached and that the view's inherited GetDocument member function returns a pointer to that object. In Chapter 15 you'll examine frame windows, and in Chapter 16 you'll learn much more about document-view interactions.



Programming Microsoft Visual C++
Programming Microsoft Visual C++
ISBN: 1572318570
EAN: 2147483647
Year: 1997
Pages: 332

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net