将formview加载到一个cwnd,需要用到运行时动态创建类信息

CRuntimeClass* pViewClass = RUNTIME_CLASS (CGuardRouteDetailFormView);
 CView* pView = DYNAMIC_DOWNCAST (CGuardRouteDetailFormView, pViewClass->CreateObject ());
 m_guardRouteDetailView = (CGuardRouteDetailFormView* )pView;
 ASSERT_VALID (pView);

 if (!pView->Create (NULL, _T(""), WS_CHILD | WS_VISIBLE,
  CRect (0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, m_pContext))
 {
  return -1;
 }

主要是CRuntimeClass这个类的使用

posted @ 2011-03-23 12:05  银翼的魔术师  阅读(288)  评论(0编辑  收藏  举报