楼上的,我明白你的意思,但楼主好象不是这样说的,参考msdn 文档:Each application that uses the Microsoft Foundation classes can only contain one object derived from CWinApp. This object is constructed when other C++ global objects are constructed and is already available when Windows calls the WinMain function, which is supplied by the Microsoft Foundation Class Library. Declare your derived CWinApp object at the global level.
the answer is:Classes derived from CObject can support dynamic creation, which is the ability to create an object of a specified class at run time. Document, view, and frame classes, for example, should support dynamic creation. The CreateObject member function can be used to implement this function and create objects for these classes during run time. For more information on dynamic creation and the CreateObject member, seeCObject Class Topics andCObject Class: Specifying Levels of Functionality in Visual C++ Programmer’s Guide. (copy msdn document)其实在run time条件下,无论document或view还是frame类对象都可以动态创建,这就是在mfc中有CRuntimeClass的原因。
而CView的却是CWnd,可以在动态创建。
派生自CView的类就可以动态创建了
sdk的,尤其是第三章,也是本书最精华的地方。 第六章,如果你有
winmain() wndproc()的sdk经验,你会读的津津有味。