Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. C / C++ / MFC
  3. CHtmlView::OnBeforeNavigate2 try to spy

CHtmlView::OnBeforeNavigate2 try to spy

Scheduled Pinned Locked Moved C / C++ / MFC
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mstuebner
    wrote on last edited by
    #1

    I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the destination, i.e. to call another functions in this application. In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now. So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this? Thanx in advance,:confused: -- regards Matthias

    J 1 Reply Last reply
    0
    • M mstuebner

      I try to write an application what is using the CHTMLView. That is quite simple. Next I wanted to implement that I get informed about when somebody clicks on a link, so I can react on it by something else than browsing to the destination, i.e. to call another functions in this application. In general it works using the CHtmlView::OnBeforeNavigate2 function. I can hook into this call, can do something else and can prevent that the browser tries to open the link, but later I get an error message that i havn't handy now. So my question would be: Am I using the right approach, or am I absolutely wrong? Does somebody have a sample on this? Thanx in advance,:confused: -- regards Matthias

      J Offline
      J Offline
      jerry0davis
      wrote on last edited by
      #2

      Am I using the right approach, or am I absolutely wrong? Sounds good to me. This is the way I do it. OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) {    char pmbbuf[MAX_PATH];    strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal);    if(pmbbuf == the_link_i'm_overriding)    {       DoSomething();       *Cancel = TRUE;    } }

      D 1 Reply Last reply
      0
      • J jerry0davis

        Am I using the right approach, or am I absolutely wrong? Sounds good to me. This is the way I do it. OnBeforeNavigate2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL, VARIANT FAR* Flags, VARIANT FAR* TargetFrameName, VARIANT FAR* PostData, VARIANT FAR* Headers, BOOL FAR* Cancel) {    char pmbbuf[MAX_PATH];    strcpy(pmbbuf, (char*)(_bstr_t)URL->bstrVal);    if(pmbbuf == the_link_i'm_overriding)    {       DoSomething();       *Cancel = TRUE;    } }

        D Offline
        D Offline
        Datacrime
        wrote on last edited by
        #3

        I'm writing an application that try to spy IE's HTTP requests. I want to get the headers and the respons headers. But OnBeforeNavigate2 gives only additional headers and there is no way to get respons headers at all. How can i do that? I think about getting the IPersist object of IE and then somehow add notification, but don't know how this can be done or if it worth trying. - - - - - - - - - - - - - - - - - - Memory leaks is the price we pay \0 01234567890123456789012345678901234

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups