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. Closing a invisible web browser

Closing a invisible web browser

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 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.
  • K Offline
    K Offline
    KongHL
    wrote on last edited by
    #1

    Hi, Is there a way to close an invisible web browser? how do i detect the web browser and close it?? Thanks!!

    B T 2 Replies Last reply
    0
    • K KongHL

      Hi, Is there a way to close an invisible web browser? how do i detect the web browser and close it?? Thanks!!

      B Offline
      B Offline
      Benoy Bose
      wrote on last edited by
      #2

      You have to do COM Programming. Interface of Internet Explorer com object is IWebBrowser2. You have to get the invisile instance of IE by calling CoGetObject() COM API. Then you can call it's interface methods to close the Invisible Browser. Once you get the COM instance of API. Then call the COM method ExecWB of IWebBrowser2 with parameter OLECMDID_CLOSE. Then the invisible browser will be closed. OK ? Regards, Benoy Bose

      K 1 Reply Last reply
      0
      • B Benoy Bose

        You have to do COM Programming. Interface of Internet Explorer com object is IWebBrowser2. You have to get the invisile instance of IE by calling CoGetObject() COM API. Then you can call it's interface methods to close the Invisible Browser. Once you get the COM instance of API. Then call the COM method ExecWB of IWebBrowser2 with parameter OLECMDID_CLOSE. Then the invisible browser will be closed. OK ? Regards, Benoy Bose

        K Offline
        K Offline
        KongHL
        wrote on last edited by
        #3

        Hmm ok.. but i cant find CoGetObject in MSDN library. May I know where can i find the declarations? Thanks!

        1 Reply Last reply
        0
        • K KongHL

          Hi, Is there a way to close an invisible web browser? how do i detect the web browser and close it?? Thanks!!

          T Offline
          T Offline
          ThatsAlok
          wrote on last edited by
          #4

          KongHL wrote:

          Is there a way to close an invisible web browser? how do i detect the web browser and close it??

          Are you sure there is Invisble Webbrowser

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

          K 1 Reply Last reply
          0
          • T ThatsAlok

            KongHL wrote:

            Is there a way to close an invisible web browser? how do i detect the web browser and close it??

            Are you sure there is Invisble Webbrowser

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

            K Offline
            K Offline
            KongHL
            wrote on last edited by
            #5

            Yes.. U can create IWebBrowser2 object and make it visible or invisible..

            T 1 Reply Last reply
            0
            • K KongHL

              Yes.. U can create IWebBrowser2 object and make it visible or invisible..

              T Offline
              T Offline
              ThatsAlok
              wrote on last edited by
              #6

              KongHL wrote:

              U can create IWebBrowser2 object and make it visible or invisible..

              your Answer is hidden in this object!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

              K 1 Reply Last reply
              0
              • T ThatsAlok

                KongHL wrote:

                U can create IWebBrowser2 object and make it visible or invisible..

                your Answer is hidden in this object!

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                K Offline
                K Offline
                KongHL
                wrote on last edited by
                #7

                ?? The problem is i created the browser in a dll (in a thread).. when i tried to terminate the thread, the browser is not closed via the quit() function. Hence I am trying to close in in the main program.. but this way, i dun have the instance of it.. I need to find it and close it right?

                T 1 Reply Last reply
                0
                • K KongHL

                  ?? The problem is i created the browser in a dll (in a thread).. when i tried to terminate the thread, the browser is not closed via the quit() function. Hence I am trying to close in in the main program.. but this way, i dun have the instance of it.. I need to find it and close it right?

                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  KongHL wrote:

                  The problem is i created the browser in a dll (in a thread).. when i tried to terminate the thread, the browser is not closed via the quit() function. Hence I am trying to close in in the main program.. but this way, i dun have the instance of it.. I need to find it and close it right?

                  Why Not have that Variable of Webbrowser as Class member  and pass the current instance of class object to thread, and using that Variable so that you can manipulate the browser from teh Main program..  don't forget to add CoInitialize(NULL)

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and You

                  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