温故而知新,学习MFC框架如何创建的过程[9]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 liukaven 的 blog

注意,我们的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() 实际创建出窗口。

本文关键:温故而知新,学习MFC框架如何创建的过程
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top