诸位大侠好小弟正在做一个浏览器程序, 我想捕获当鼠标在一个Web页面点击的URL地址, 
并且在新页面调用显示一个另外URL的地址页面.请问应该如何做呢? 好像在
浏览器事件中从Web页面点击的URL地址进行调用显示没有专门的函数? 我没
找到:(请诸位大侠不吝赐教.新年快乐麦克小熊

解决方案 »

  1.   

    这个很麻烦web浏览器中的页面是一个ole对象
      

  2.   

    handle NewWindow2 Event
    see http://www.csdn.net/Develop/read_article.asp?id=21702
      

  3.   

    谢谢两位大侠的指点,但我还没有完全搞明白,我的NewWindws的Event代码是void CIEView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel) 
    {
    // TODO: Add your specialized code here and/or call the base class
    Cancel=FALSE;
    LRESULT pResult=AfxGetMainWnd()->SendMessage(WM_NEW_IEVIEW);
    CWnd* pWnd=(CWnd*)pResult;
    ASSERT(pWnd->IsKindOf(RUNTIME_CLASS(CIEView)));
    *ppDisp = ((CIEView*)pWnd)->GetApplication();
    //CHtmlView::OnNewWindow2(ppDisp, Cancel);
    }但我确实没有找到能够象我需要的那样, 捕捉到页面点击的URL, 但点击后却可以使浏览器
    调用显示另外一个URL页面的办法. 请诸位大侠多多帮助, 小弟万分感谢!!!!麦克小熊
      

  4.   

    我看到了蒋大侠提供的文档, 可是我没有找到具体有关从页面URL点击调用
    一个新页面的代码, 请那位熟悉的大侠讲详细一点好吗. 小弟万分感谢!!!我看到文档上的代码为void CIEAutomationView::OnNewWindow2(LPDISPATCH* ppDisp, BOOL* Cancel) 

     // Get a pointer to the application object. 
     CWinApp* pApp = AfxGetApp(); 
     // Get the correct document template. 
     POSITION pos = pApp->GetFirstDocTemplatePosition(); 
     CDocTemplate* pDocTemplate = pApp->GetNextDocTemplate( pos ); 
     // Create a new frame. 
     CFrameWnd* pFrame = pDocTemplate->CreateNewFrame( 
      GetDocument(), 
      (CFrameWnd*)AfxGetMainWnd() ); 
     // Activate the frame. 
     pDocTemplate->InitialUpdateFrame( pFrame, NULL ); 
     CIEAutomationView* pView = (CIEAutomationView*)pFrame->GetActiveView(); 
     // Pass pointer of WebBrowser object. 
     pView->SetRegisterAsBrowser( TRUE ); 
     *ppDisp = pView->GetApplication(); 
    } 麦克小熊