其中 (ptarget->*mmf.pfn_cmd_v_v)() 对cwinapp::onfilenew() 产生调用,ptarget = cmditestapp类实例。调用进入如下:
|
void cwinapp::onfilenew() { if (m_pdocmanager != null) m_pdocmanager->onfilenew(); } |
进入进入到cdocmanager::onfilenew()
|
void cdocmanager::onfilenew() { if (m_templatelist.isempty()) // 提示没有模板并返回 cdoctemplate* ptemplate = (cdoctemplate*)m_templatelist.gethead(); // 第一个 if (m_templatelist.getcount() > 1) // 弹出一个对话框(很难看的)提示用户选择一个文档模板 // 在这个例子里面,ptemplate 就是 cmditestapp::initinstance() 里面创建的那个模板 ptemplate->opendocumentfile(null); } |