注意,我们的mditest application的主窗口cmainframe是从cmdiframewnd派生的,所以进入到这里,参考代码中红色的注释部分。继续跟踪进入cframewnd::loadframe。
|
bool cframewnd::loadframe(uint nidresource, dword dwdefaultstyle, cwnd* pparentwnd, ccreatecontext* pcontext) { // only do this once assert_valid_idr(nidresource); // nidresource = 128, idr_mainframe assert(m_nidhelp == 0 || m_nidhelp == nidresource); m_nidhelp = nidresource; // id for help context (+hid_base_resource) cstring strfullstring; if (strfullstring.loadstring(nidresource)) // = “mditest” afxextractsubstring(m_strtitle, strfullstring, 0); // 取得第一个子串 verify(afxdeferregisterclass(afx_wndframeorview_reg)); // attempt to create the window // geticonwndclass 会调用 virtual precreatewindow 函数,别处也会调用,从而 // 使得子类的precreatewindow 将被调用多次 lpctstr lpszclass = geticonwndclass(dwdefaultstyle, nidresource); cstring strtitle = m_strtitle; // 调用 cframewnd::create() 实际创建出窗口。 首页
上页
下页
尾页
[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框架如何创建的过程
|