1. Start a dialog based MFC Application
2. Add a class inherit from CView ( Here I add a class named CDictView inherit from CHtmlView)
3. Add following code in OnInitDialogDone!
CCreateContext ctx1;
ctx1.m_pCurrentDoc = NULL;
ctx1.m_pCurrentFrame = NULL;
ctx1.m_pLastView = NULL;
ctx1.m_pNewDocTemplate = NULL;
ctx1.m_pNewViewClass = RUNTIME_CLASS(CDictView); 
CDictView* dictView = NULL;
dictView = (CDictView*)((CFrameWnd *)this)->CreateView(&ctx1);
CRect rectClient;
//GetDlgItem(IDC_STATIC1)->GetClientRect(rectClient);
//GetDlgItem(IDC_STATIC1)->MapWindowPoints(this, rectClient);
//rectClient.DeflateRect(0,0);
GetClientRect(&rectClient);
dictView->MoveWindow(rectClient);
dictView->UpdateWindow();
Pass the compilation on VS 2008.
MFC应用中嵌入HTML视图
本文介绍如何在基于MFC的应用程序中创建对话框,并通过继承CHtmlView来实现自定义视图CDictView。具体步骤包括:1. 创建基于对话框的MFC应用程序;2. 添加继承自CHtmlView的CDictView类;3. 在OnInitDialog中通过CCreateContext创建并显示CDictView实例。
2084

被折叠的 条评论
为什么被折叠?



