再接着进行createnewframe。
|
cframewnd* cdoctemplate::createnewframe(cdocument* pdoc, cframewnd* pother) { // create a frame wired to the specified document ccreatecontext context; // 这个 createcontext 传递到 loadframe 中 context.m_pcurrentframe = pother; // 此例中 = null context.m_pcurrentdoc = pdoc; // = 刚才创建的文档 context.m_pnewviewclass = m_pviewclass; // 显示此文档的视类的类型 context.m_pnewdoctemplate = this; if (m_pframeclass == null) // 提示错误并返回 // 利用 cruntimeclass 信息创建框架窗口对象,此例中为 cchildframe cframewnd* pframe = (cframewnd*)m_pframeclass->createobject(); // 这里,我们又看到了 loadframe , 参考前面的 loadframe 吧 // 在这里面,view 窗口也被产生出来。参考 trace 输出。 pframe->loadframe(m_nidresource, ws_overlappedwindow | fws_addtotitle, // default frame styles null, &context); return pframe; } |