In a traditional Windows program, you create your own Windows registration class by filling in a WNDCLASS structure and passing it to the RegisterClass function. If you are using the Microsoft Foundation Class Library, you typically derive a window class from an existing Foundation class using the normal C++ syntax for class inheritance. For frame windows, the Microsoft Foundation Class Library provides three base classes from which you can derive your frame window classes.
Base class | Frame window class |
CFrameWnd | Standard frame window |
CMDIFrameWnd | Multiple Document Interface frame window |
CMDIChildWnd | Multiple Document Interface child window |
The Microsoft Foundation Class Library also provides other C++ classes that support other types of windows, such as dialog boxes and controls. These other classes are covered in later sections of the cookbook. Each of these base classes provides default functionality that is appropriate to the function of the window.
When you derive your frame window from an existing Microsoft Foundation frame window class, you will complete two main tasks:
1.Define a constructor for the derived class.
2.Define message-handling functions and a message map for the derived class so that window messages coming to the derived window can be correctly routed to the proper handler functions.
These two tasks are described in the following two sections.