归纳一下,loadframe中进行了如下事情:
1、 注册窗口类(afxdeferregisterclass)
2、 实际创建窗口(create)
3、 处理菜单、快捷键,发送wm_initialupdate消息给所有子窗口。实际将在cview中处理此消息。(例如:在toolbar上面放一个formview,可能就能收到这个消息并处利?)
至此,cmainframe已经成功创建,菜单已经装载,工具条、状态行等已经在cmainframe::oncreate中创建。让我们接着研究第一个子窗口是怎么被创建出来的,该过程和cmainframe::loadframe比起来就不那么直接了。
研究cwnd::processshellcommand
第一个mdi子窗口是从这里面建立出来的,这实在是缺乏直观性。不过mfc就是这样,没办法。
|
bool cwinapp::processshellcommand(ccommandlineinfo& rcmdinfo) { bool bresult = true; switch (rcmdinfo.m_nshellcommand) { case ccommandlineinfo::filenew: if (!afxgetapp()->oncmdmsg(id_file_new, 0, null, null)) // 关键是这里 onfilenew(); if (m_pmainwnd == null) bresult = false; break; 首页
上页
下页
尾页
[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框架如何创建的过程
|