借鉴了很多代码,最终实现如下:在对话框初始化函数添加:BOOL CMsgManage::OnInitDialog() { CDialog::OnInitDialog(); CFrameWnd* pFrameWnd = new CFrameWnd(); CRect rec; GetDlgItem(IDC_VIEW_ADGE)->GetWindowRect(rec); ScreenToClient(rec); pFrameWnd->Create(NULL,NULL,WS_VISIBLE|WS_CHILD,rec,this); CCreateContext cc; cc.m_pCurrentDoc = m_pDoc; cc.m_pNewViewClass = RUNTIME_CLASS(CUIView); CUIView *pView=(CUIView *)((CFrameWnd*)pFrameWnd)->CreateView(&cc); pView->UpdateWindow(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
其中m_pDoc是当前DOC类的一个指针,在对话框DOMODAL之前赋值;
在MDI程序弹出对话框内嵌入CView
最新推荐文章于 2019-05-13 21:16:55 发布