不能用IE打開(kāi),屬于不同的進(jìn)程session 丟失,新窗口要用自己的瀏覽器再打,也就是要套一個(gè)C++的框框
重載OnNewWindow2()
這是有DOC文檔模型的:
void CUClientView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel)
{
CWinApp* pApp = AfxGetApp();
POSITION pos = pApp-> GetFirstDocTemplatePosition();
CDocTemplate* pDocTemplate = pApp-> GetNextDocTemplate( pos );
CFrameWnd* pFrame = pDocTemplate-> CreateNewFrame(
GetDocument(),
(CFrameWnd*)AfxGetMainWnd() );
pDocTemplate-> InitialUpdateFrame( pFrame,NULL);
CUClientView* pView = (CUClientView*)pFrame-> GetActiveView();
pView-> SetRegisterAsDropTarget(TRUE);
*ppDisp = pView-> GetApplication();
}
這個(gè)是沒(méi)有DOC模型的:
void CNoticeHtmlView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel)
{
CMainFrame* pMainFrm = (CMainFrame*)AfxGetMainWnd();
CChildFrame* m_pNoticeView=new CChildFrame();
m_pNoticeView->SetNeedBar(FALSE);
CCreateContext context;
context.m_pNewViewClass=RUNTIME_CLASS(CNoticeHtmlView);
if(!m_pNoticeView->LoadFrame(IDR_MAINFRAME,WS_OVERLAPPEDWINDOW,pMainFrm,&context))
return;
m_pNoticeView->InitialUpdateFrame(NULL,true);
m_pNoticeView->SetWindowText(_T("xxxxx"));
CNoticeHtmlView* pWBVw = (CNoticeHtmlView*)(m_pNoticeView->GetActiveView());
ASSERT(pWBVw);
pWBVw->SetRegisterAsBrowser(TRUE);
*ppDisp = pWBVw->GetApplication();
if(*ppDisp!=NULL)
*Cancel = FALSE;
}
這樣就能用我的新窗口來(lái)打開(kāi)聯(lián)接的彈出窗口(要不總是彈出ie的窗口)。
為了在點(diǎn)擊網(wǎng)頁(yè)中的關(guān)閉窗口按鈕時(shí),能關(guān)閉窗口,我重載了
BOOL CUClientView::PreTranslateMessage(MSG* pMsg)
{
if(pMsg-> message==WM_CLOSE && pMsg-> hwnd==m_wndBrowser.GetSafeHwnd())
PostMessage(WM_COMMAND,ID_FILE_CLOSE);
return CHtmlView::PreTranslateMessage(pMsg);
}
結果是點(diǎn)擊網(wǎng)頁(yè)中的關(guān)閉窗口按鈕時(shí),把所有有聯(lián)接關(guān)系的網(wǎng)頁(yè)都關(guān)閉了??!
怎樣結決這個(gè)問(wèn)題!
問(wèn)題很是麻煩,期待有高手幫幫我!非常感謝??!
聯(lián)系客服