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#
  4. Is it possible to use webbrowser control outside a form ?

Is it possible to use webbrowser control outside a form ?

Scheduled Pinned Locked Moved C#
htmlquestion
7 Posts 2 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.
  • G Offline
    G Offline
    GriffonRL
    wrote on last edited by
    #1

    Hello, I would like to know if it is possible to use the webbrowser control just to navigate a webpage and then traverse its DOM, without creating a form and even in a console application ? Thanks, R. LOPES Just programmer.

    S 1 Reply Last reply
    0
    • G GriffonRL

      Hello, I would like to know if it is possible to use the webbrowser control just to navigate a webpage and then traverse its DOM, without creating a form and even in a console application ? Thanks, R. LOPES Just programmer.

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

      Lookup a sample called WalkAll in MSDN.

      G 1 Reply Last reply
      0
      • S Stephane Rodriguez

        Lookup a sample called WalkAll in MSDN.

        G Offline
        G Offline
        GriffonRL
        wrote on last edited by
        #3

        Hello Stephane, Ok but WalkAll uses only the MSHTML component. I'm trying to use the WebBrowser control because it adds a lot of navigation stuff I would like not to take care of. Thanks, R. LOPES Just programmer.

        S 1 Reply Last reply
        0
        • G GriffonRL

          Hello Stephane, Ok but WalkAll uses only the MSHTML component. I'm trying to use the WebBrowser control because it adds a lot of navigation stuff I would like not to take care of. Thanks, R. LOPES Just programmer.

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

          :confused: UI --> iexplore.exe | web ocx no UI --> walkall Both have the DOM and the IWebBrowser interface (shdocvw) to play with.

          G 1 Reply Last reply
          0
          • S Stephane Rodriguez

            :confused: UI --> iexplore.exe | web ocx no UI --> walkall Both have the DOM and the IWebBrowser interface (shdocvw) to play with.

            G Offline
            G Offline
            GriffonRL
            wrote on last edited by
            #5

            Hello, Ok then. So what is the DLL I'm supposed to use ? Shdoccvw or mshtml ? Or both ? And what happens without any UI when a NewWindow event is trigerred ? Thanks, R. LOPES Just programmer.

            S 1 Reply Last reply
            0
            • G GriffonRL

              Hello, Ok then. So what is the DLL I'm supposed to use ? Shdoccvw or mshtml ? Or both ? And what happens without any UI when a NewWindow event is trigerred ? Thanks, R. LOPES Just programmer.

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

              GriffonRL wrote: Ok then. So what is the DLL I'm supposed to use ? Shdoccvw or mshtml ? Or both ? the primary dll is shdocvw which provides the url navigation. then, if you query interface and request the IHTMLDocument interface (if you want to play with the DOM), mshtml.dll is automatically loaded. GriffonRL wrote: I'm supposed to use ? :confused: You are using COM interfaces. Why should you bother about the DLLs themselves? GriffonRL wrote: And what happens without any UI when a NewWindow event is trigerred ? An event is what you make of it. The UI less sample in walk all does not register itself for events, so it will never receive them. If you want those events, you've got to add a look up on the COM server IConnectionPointContainer interface waiting for you. (there is sample code for that in Codeproject, MSDN, ...).

              G 1 Reply Last reply
              0
              • S Stephane Rodriguez

                GriffonRL wrote: Ok then. So what is the DLL I'm supposed to use ? Shdoccvw or mshtml ? Or both ? the primary dll is shdocvw which provides the url navigation. then, if you query interface and request the IHTMLDocument interface (if you want to play with the DOM), mshtml.dll is automatically loaded. GriffonRL wrote: I'm supposed to use ? :confused: You are using COM interfaces. Why should you bother about the DLLs themselves? GriffonRL wrote: And what happens without any UI when a NewWindow event is trigerred ? An event is what you make of it. The UI less sample in walk all does not register itself for events, so it will never receive them. If you want those events, you've got to add a look up on the COM server IConnectionPointContainer interface waiting for you. (there is sample code for that in Codeproject, MSDN, ...).

                G Offline
                G Offline
                GriffonRL
                wrote on last edited by
                #7

                Hello, I think I am missing something :(. I used to use the webbrowser control (shdocvw) for simpler programs because I understood mshtml was only the HTML parser/Javascript interpreter/DOM builder and I wanted to keep the UI. I know how to walk the DOM using the mshtml interfaces. But I don't know what kind of object I have to create from shdocvw to provide me with url navigation without the UI mess. I tried several things like creating WebBrowser,IWebBrowserApp,IWebBrowser2 interfaces but I get errors when calling the Navigate2 method (some COM exception) ! Forgive my ignorance but I am currently stuck and lost with all the interfaces/classes from shdocvw :wtf:. Any help, advice or link to relevant articles are welcome. Also for examples using the IConnectionPointContainer you are talking about. Thanks, R. LOPES Just programmer.

                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