OnNewWindow2 问题,高分急求,在线等
网上看到这样一段代码,说是用于单文档和多文档的。
// Get a pointer to the application object
CWinApp* pApp = AfxGetApp();
// Get the correct document template
CDocTemplate* pDocTemplate;
POSITION pos = pApp->GetFirstDocTemplatePosition();
pDocTemplate = pApp->GetNextDocTemplate(pos);
ASSERT(pDocTemplate);
// Create the new frame
CFrameWnd* pNewFrame = pDocTemplate->CreateNewFrame(GetDocument(),
(CFrameWnd*)AfxGetMainWnd());
ASSERT(pNewFrame);
// Activate the frame and set its active view
pDocTemplate->InitialUpdateFrame(pNewFrame, NULL);
CYourView* pWBVw = (CYourView*)pNewFrame->GetActiveView();
ASSERT(pWBVw);
pWBVw->m_webBrowser.SetRegisterAsBrowser(TRUE);
*ppDisp = pWBVw->m_webBrowser.GetApplication();
我现在的程序是单文档的基于CFormView的,请问怎么套用这段代码呢?CFrameWnd需要变成CMainFrame吗?GetDocument()总是提示没有怎么办?CYourView就用我现在那个唯一的view可以吗?谢谢在线等