在对话框中内嵌了个CHtmlView类的派生类,但是不能调用CHtmlView的成员函数GetHtmlDocument,会出现错误
:
UrbanRoadTrafficWarningSys.exe 中的 0x78b72a2c (mfc90ud.dll) 处未处理的异常: 0xC0000005: 读取位置 0xcccccdbc 时发生访问冲突
不知是哪错误了
:
UrbanRoadTrafficWarningSys.exe 中的 0x78b72a2c (mfc90ud.dll) 处未处理的异常: 0xC0000005: 读取位置 0xcccccdbc 时发生访问冲突
不知是哪错误了
调用这个函数需要页面加载已完成才行。在DocumentComplelete事件中进行调用!
CCreateContext pContext;
CWnd* pFrameWnd = this;
pContext.m_pCurrentDoc = new CMapHtmlDoc;
pContext.m_pNewViewClass = RUNTIME_CLASS(CMapHtmlView);
CMapHtmlView *hv =(CMapHtmlView *) ((CFrameWnd*)pFrameWnd)->CreateView(&pContext);
获取创建View类
现在改为
CRuntimeClass *pViewClass = RUNTIME_CLASS(CMapHtmlView);
CCreateContext * pContext;
pContext = new CCreateContext;
pContext->m_pCurrentDoc = NULL;
pContext->m_pCurrentFrame = NULL;
pContext->m_pLastView = NULL;
pContext->m_pNewDocTemplate =NULL;
pContext->m_pNewViewClass = pViewClass;
CWnd * pWnd = NULL;
pWnd = DYNAMIC_DOWNCAST(CWnd,pViewClass->CreateObject());
pWnd ->Create(NULL,NULL,AFX_WS_DEFAULT_VIEW,CRect(0,0,0,0),this,0,pContext);
delete pContext;
hv= DYNAMIC_DOWNCAST(CMapHtmlView,pWnd);
就没错了,不知道是什么原因?