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. General Programming
  3. C / C++ / MFC
  4. WebBrowser Control & Getting the HTML Source

WebBrowser Control & Getting the HTML Source

Scheduled Pinned Locked Moved C / C++ / MFC
helphtmlcom
5 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.
  • C Offline
    C Offline
    carrie
    wrote on last edited by
    #1

    hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys

    S C 2 Replies Last reply
    0
    • C carrie

      hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys

      S Offline
      S Offline
      Stephane Rodriguez
      wrote on last edited by
      #2

      You've probably dropped the IE ocx onto your dialog. To get the Html from the current web page, you just need to call this method : HRESULT IWebBrowser2::get_Document(IDispatch** ppDisp); It returns a IDispatch interface which actually you can cast to IHTMLDocument2. This one is the DOM, ie provides access to the html tags hierarchy.


      sometimes it helps to look at the IL generated code a MS guy on develop.com "answering" .NET issues

      C 1 Reply Last reply
      0
      • S Stephane Rodriguez

        You've probably dropped the IE ocx onto your dialog. To get the Html from the current web page, you just need to call this method : HRESULT IWebBrowser2::get_Document(IDispatch** ppDisp); It returns a IDispatch interface which actually you can cast to IHTMLDocument2. This one is the DOM, ie provides access to the html tags hierarchy.


        sometimes it helps to look at the IL generated code a MS guy on develop.com "answering" .NET issues

        C Offline
        C Offline
        carrie
        wrote on last edited by
        #3

        Fantastic stephane, can't thank you enough :) Thats just the sort of answer I was looking for. Thanks again.

        1 Reply Last reply
        0
        • C carrie

          hello again :) I'm trying to use the MS WebBrowser control in a dialog based application I'm making and I'm having the problem that I need to get access to the HTML code so I can work with it inside the program. The interface and most of the supporting stuff is looking good but I can't grast this final problem. It doesn't help that I'm no COM wizard but I'm always willing to learn :) Thanks guys

          C Offline
          C Offline
          ColinDavies
          wrote on last edited by
          #4

          Note a lot of folk have trouble trying to use it, because they don't wait for the DocComplete to fire before altering the page. Try searching the old MSJ for articles by Scott Roberts also, might help. Regardz Colin J Davies

          Sonork ID 100.9197:Colin

          You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.

          C 1 Reply Last reply
          0
          • C ColinDavies

            Note a lot of folk have trouble trying to use it, because they don't wait for the DocComplete to fire before altering the page. Try searching the old MSJ for articles by Scott Roberts also, might help. Regardz Colin J Davies

            Sonork ID 100.9197:Colin

            You are the intrepid one, always willing to leap into the fray! A serious character flaw, I might add, but entertaining. Said by Roger Wright about me.

            C Offline
            C Offline
            carrie
            wrote on last edited by
            #5

            hehe, a sneaky bit of info hidden in the periodicals, thanks for pointing it out Colin, I'm sure its going to come in handy :) Thanks guys, you're stars :)

            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