case ccommandlineinfo::fileopen: // 忽略
case ccommandlineinfo::fileprintto: // 忽略
case ccommandlineinfo::fileprint:
case ccommandlineinfo::filedde:
case ccommandlineinfo::appregister:
case ccommandlineinfo::appunregister:
}
return bresult;
}
进入到processshellcommand,要处理很多种不同命令,我们忽略其它命令,单独看filenew部分。
注意:实际进入到了afxgetapp()->oncmdmsg(id_file_new, 0, null, null)之中。
afxgetapp()实际返回了cmditestapp的唯一实例,它从cwinapp – cwinthread – ccmdtarget – cobject 派生而来。我们没有重载oncmdmsg,所以进入到ccmdtarget的oncmdmsg处理中。为了研究,我们删减了一些代码。
|
bool ccmdtarget::oncmdmsg(uint nid, int ncode, void* pextra, afx_cmdhandlerinfo* phandlerinfo) { // 这里删减了一些代码 // determine the message number and code (packed into ncode) const afx_msgmap* pmessagemap; const afx_msgmap_entry* lpentry; uint nmsg = 0; // 这里删减了一些代码,处理后 nmsg = wm_command // 为了简化,删减了一些断言等。以下循环用于查找处理此消息的入口。 首页
上页
下页
尾页
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
[21]
[22]
[23]
[24]
[25]
本文关键:温故而知新,学习MFC框架如何创建的过程
|