"In-depth and shallow MFC" is a book that I have been read. Although I have just learned from VC, I always feel that the harvest is not big. After a period of program design practice, now go back to see These things, I feel that there is a lot of harvests, maybe this is the reason I like this book, the more you read more taste, the more I read, the more I feel that the things in the book can make up for my shortcomings, so this is really really getting Read the fun. The following is extracted from some original text and summarizes some learning experience, and the right to be a little small learning gain, and I hope to get more understanding and experience in writing and reading.
The article structure is as follows, first references some of the original text, then it is his own learning experience, and finally translates a paragraph of explanation in the original text. For important books to repeatedly read, I have consistently take this reading, read the frame structure, in Detailed study, from China to find a keyword sentence, write your own experience, then repeatedly understand, know that thorough understanding, only this, can not live with an excellent technical book author's good intention and time spending time And energetic.
original:
Strong agglomeration, the organized class library is Application Framework. A combination of uncomfortable objects, communicating with each other, communicating with information, and calls each other's function to complete the task, this is Application Framework.
For the arrangement of the data structure, the data processing, data display, the Application Framework can provide, all the single empty shell - in the C language is a virtual function. Software developers must find ways to transform these virtual functions to meet individual needs.
Obviously, Application Framework is a set of super class libraries that can be called Framework must be in which the class properties are closely biting, echoing each other.
In 1989, Microsoft established the Application Framework technology team called the AFX team to develop C object-oriented tools to use Windows application developers. AFX 's "X" is actually not meaningful, just in order to make a name.
Learning experience:
Application Framework As the "Application Framework", it is a huge framework that provides a basic implementation platform for program development, making us more efficient work on a group of excellent engineers. And in particular, it is actually a complete class library, which encapsulates a function of implementing various functions. Users can understand the interfaces of these class libraries without having to understand the practical procedures. . The most common three sets of C Application Frameworks include Microsoft's MFC, Borland's OWL, and Open Class Library for IBM VisuaLage. So, if Application Frameworks is treated as a frame structure based on object-oriented theory, the above three type libraries are specific implementations.
original:
MFC helps us use these nature of APIs, logically organize them, enabling them to have abstraction, packaging, inheritance, polymorphism, modular nature.
In order to make MFC as small as possible, as fast as possible, the AFX team has to abandon the height abstraction, and introduce their own inventive mechanisms, try to solve the processing problem of Windows messages in the object-oriented domain. Message mapping and message routing mechanisms. They have designed some macros that are called, and these macro hide huge mechanisms. Understand these macros (and the mechanisms represented behind them), as well as those "troubles" that are sufficient to expose prototypes in the MFC class, which I think it is important to master the MFC's Application Frameworks.
The MFC class is mainly divided into the following large groups:
General Purpose Classes: Provides a string class, data processing class, exception handling class, file class, and more.
Windows API Classes: Used to encapsulate Windows APIs, such as window classes, dialog classes, DC classes, and more.
Application Framework Classes: The application backbone, that is, this group, including Document / View, Message Pump, Message Mapping, Message Pass, Dynamic Creation, File Read and Writing, etc.
High level Abstrations: Includes toolbars, status bar, split window, scrolling window, and more.
Operation System Extensions: Pack OLE, ODBC, DAO, MAPI, Winsock, ISAPI, and more.
Learning experience:
I used to use only to use it. Now I have a further understanding of the concept of MFC. In the programming process, I should first consider the group you implement belong to the group of MFC classes, and then choose to fit your own in the corresponding group. The class is developed while expanding according to your own needs.
The following is a translation of the Readme.txt file in the example of the example program in the book, and individuals think that although the file is the most common file generated in the MFC framework, it can understand the basic use of various files generated by the MFC. The process of translation is also a good learning process.
============================================================================================================================================================================================================= ======================
Microsoft Foundation Class Library: Scribble
============================================================================================================================================================================================================= ======================
AppWizard creates the Scribble program for you. The program not only demonstrates the basic use of MFC, but also the starting point for your writing application. This file summarizes the program used by the Scribble program.
Scribble.h
This is the header file of the application. Other specific header files (including resource.h) and declare the CSCRIBBLEAPP application class.
Scribble.cpp
This is the primary application source file containing application class CSCribbleapp.
Scribble.rc
This file gives all Microsoft Windows resource lists used by the program. Includes icons, images, and cursors stored under the RES sub path. This file can be edited directly in Microsoft Developer Studio.
RES / SCRIBBLE.ICO
Icon file, used as an application icon, which is included in the primary resource file Scribble.rc.
Res / scribble.rc2
The file contains resources that cannot be edited by Microsoft Developer Studio. Therefore, all invigible resources will be placed in this file.
Scribble.clw
This file contains the information you want to use to edit the existing classes and add new classes. ClassWizard also uses this file to store information for creating and editing message mapping, dialog data mapping, and creating member functions.
/
For the main frame window:
Mainfrm.h, mainfrm.cpp
These files contain the framework class CMAINFRAME derived from the cmdiframewnd to control all MDI framework features.
Res / Toolbar.BMP
This picture is used to create a picture to be used by the toolbar. The CMAINFRAME class creates the initial toolbar and status bar. Edit MAINFRM.CPP The array related to this toolbar image can add more toolbar buttons.
/
AppWizard Creates a document type and a document view
ScribbleDoc.h, scribbledoc.cpp - documentation
These files contain CSCribbleDoc classes. You can add special document data to these files and save your files and load (via cscribbledoc :: serialize).
Scribbleview.h, scribbleview.cpp - document view
These files contain CSCRIBBLEVIEW classes. The CSCribbleView object is used to view the CSCribbleDoc object.
Res / ScribbleDoc.ico
Icon file, used as MDI sub-window icon. The primary resource file scribble.rc contains this icon.
/
Other standard files:
STDAFX.H, stdafx.cpp
These files are used to create a pre-compiled header file (PCH file) and a file stdafx.obj for a precompiled type.
Resource.h
Standard header file creates new resource IDs. Microsoft Developer Studio reads and updates the file.
The following information can be obtained by the above content:
That is the primary file of the application, those files are used to implement document / view structure, those files are used to process document data, those who are resource files, where they are used, and what is the function of all headers, after reading it, it is Not some gains.