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. COM
  4. Launching multiple IE [modified]

Launching multiple IE [modified]

Scheduled Pinned Locked Moved COM
c++comtestingcollaborationbeta-testing
10 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.
  • N Offline
    N Offline
    Nirav Doshi
    wrote on last edited by
    #1

    Hi, For a particular requirement, currently my testing team has isolated multiple copes of IE5.5 (in seperate folders with *all* the required DLLs within that folder). They launch multiple copies (sometimes upto 100) of the IE5.5 for their testing to allow individual sessions. I'm trying to automate this, and for the same (with my very limited knowledge of COM) am trying to do the following. Please help me here to tell me if I am on the right track?: 1. I have a dialog based MFC app can launch each of the 100 different copies of IE 5.5 from their individual 100 folders using CreateProcess() 2. In the app I'm also doing (only once - I suppose this is primarily required for generating the TLH/TLI files):

    #import "C:\IE Copies\IE551-1\SHDOCVW.DLL"
    

    Doubt: As each of the 100 folders containing the IE5.5 have their own SHDOCVW.DLL, do I need to import them individually, or should this suffice? 3. After the IEs are running, next I need to "reach" their individual IWebBrowser2 interfaces (exposed by their SHDOCVW.DLL) so that I can invoke the navigation methods to automate visiting sites, logging in, etc. Please note - The IEs are *not* registered with the system (obviously) - and so the usual methods may not work. Doubt: Is there some way I can use CoCreateInstance() such that I can launch each of the IE5 copies, even though they're not registered on the system. Sorry - if this sounds crude/crazy... I'd really appreciate if you can suggest a solution to this -- or even a more appropriate/elegant method to get this going. Thanks a lot in advance, for your time & efforts. Rgds, nd

    modified on Thursday, June 5, 2008 2:31 PM

    N M J 3 Replies Last reply
    0
    • N Nirav Doshi

      Hi, For a particular requirement, currently my testing team has isolated multiple copes of IE5.5 (in seperate folders with *all* the required DLLs within that folder). They launch multiple copies (sometimes upto 100) of the IE5.5 for their testing to allow individual sessions. I'm trying to automate this, and for the same (with my very limited knowledge of COM) am trying to do the following. Please help me here to tell me if I am on the right track?: 1. I have a dialog based MFC app can launch each of the 100 different copies of IE 5.5 from their individual 100 folders using CreateProcess() 2. In the app I'm also doing (only once - I suppose this is primarily required for generating the TLH/TLI files):

      #import "C:\IE Copies\IE551-1\SHDOCVW.DLL"
      

      Doubt: As each of the 100 folders containing the IE5.5 have their own SHDOCVW.DLL, do I need to import them individually, or should this suffice? 3. After the IEs are running, next I need to "reach" their individual IWebBrowser2 interfaces (exposed by their SHDOCVW.DLL) so that I can invoke the navigation methods to automate visiting sites, logging in, etc. Please note - The IEs are *not* registered with the system (obviously) - and so the usual methods may not work. Doubt: Is there some way I can use CoCreateInstance() such that I can launch each of the IE5 copies, even though they're not registered on the system. Sorry - if this sounds crude/crazy... I'd really appreciate if you can suggest a solution to this -- or even a more appropriate/elegant method to get this going. Thanks a lot in advance, for your time & efforts. Rgds, nd

      modified on Thursday, June 5, 2008 2:31 PM

      N Offline
      N Offline
      Nirav Doshi
      wrote on last edited by
      #2

      I think I can use the concept from: How to get IHTMLDocument2 from a HWND[^] Since the method needs a HWND, I need to write a PIDtoHWND() after I do the CreateProcess() which will get me only the PID. Phew... I hope this works! Yet to test it. Thanks, nd

      N 1 Reply Last reply
      0
      • N Nirav Doshi

        Hi, For a particular requirement, currently my testing team has isolated multiple copes of IE5.5 (in seperate folders with *all* the required DLLs within that folder). They launch multiple copies (sometimes upto 100) of the IE5.5 for their testing to allow individual sessions. I'm trying to automate this, and for the same (with my very limited knowledge of COM) am trying to do the following. Please help me here to tell me if I am on the right track?: 1. I have a dialog based MFC app can launch each of the 100 different copies of IE 5.5 from their individual 100 folders using CreateProcess() 2. In the app I'm also doing (only once - I suppose this is primarily required for generating the TLH/TLI files):

        #import "C:\IE Copies\IE551-1\SHDOCVW.DLL"
        

        Doubt: As each of the 100 folders containing the IE5.5 have their own SHDOCVW.DLL, do I need to import them individually, or should this suffice? 3. After the IEs are running, next I need to "reach" their individual IWebBrowser2 interfaces (exposed by their SHDOCVW.DLL) so that I can invoke the navigation methods to automate visiting sites, logging in, etc. Please note - The IEs are *not* registered with the system (obviously) - and so the usual methods may not work. Doubt: Is there some way I can use CoCreateInstance() such that I can launch each of the IE5 copies, even though they're not registered on the system. Sorry - if this sounds crude/crazy... I'd really appreciate if you can suggest a solution to this -- or even a more appropriate/elegant method to get this going. Thanks a lot in advance, for your time & efforts. Rgds, nd

        modified on Thursday, June 5, 2008 2:31 PM

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        #import just creates the TLH/TLI wrappers as you said. Since all the IEs are the same version, they will support the same COM interfaces, so just one #import will be enough.

        --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

        N 1 Reply Last reply
        0
        • N Nirav Doshi

          I think I can use the concept from: How to get IHTMLDocument2 from a HWND[^] Since the method needs a HWND, I need to write a PIDtoHWND() after I do the CreateProcess() which will get me only the PID. Phew... I hope this works! Yet to test it. Thanks, nd

          N Offline
          N Offline
          Nirav Doshi
          wrote on last edited by
          #4

          Stuck up once again! :( I've used the code & concept as given at: How to get IHTMLDocument2 from a HWND[^] With that, though I have a valid CComPtr<IHTMLDocument2> spHTMLDoc2, (valid because the spHTMLDoc2->put_bgColor(CComVariant("blue")) works fine) the get_parentWindow() doesn't work and gets a 0x00000000 in the spHTMLWindow2. Is there something wrong with the way I'm doing this?

          spHTMLDoc2->put_bgColor(CComVariant("blue"));

          CComPtr<IHTMLWindow2> spHTMLWindow2;
          hr = spHTMLDoc2->get_parentWindow(&spHTMLWindow2);

          Thanks!

          * Blood donation is the most superior form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

          modified on Saturday, June 14, 2008 2:16 AM

          N 1 Reply Last reply
          0
          • M Michael Dunn

            #import just creates the TLH/TLI wrappers as you said. Since all the IEs are the same version, they will support the same COM interfaces, so just one #import will be enough.

            --Mike-- Visual C++ MVP :cool: LINKS~! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ "That's what's great about doing user interface work. No matter what you do, people will say that what you did was idiotic." -- Raymond Chen

            N Offline
            N Offline
            Nirav Doshi
            wrote on last edited by
            #5

            Mike, thanks for the confirmation! :-) I'm still stuck up in a problem, posted above. Any ideas there? :doh:

            * Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

            1 Reply Last reply
            0
            • N Nirav Doshi

              Hi, For a particular requirement, currently my testing team has isolated multiple copes of IE5.5 (in seperate folders with *all* the required DLLs within that folder). They launch multiple copies (sometimes upto 100) of the IE5.5 for their testing to allow individual sessions. I'm trying to automate this, and for the same (with my very limited knowledge of COM) am trying to do the following. Please help me here to tell me if I am on the right track?: 1. I have a dialog based MFC app can launch each of the 100 different copies of IE 5.5 from their individual 100 folders using CreateProcess() 2. In the app I'm also doing (only once - I suppose this is primarily required for generating the TLH/TLI files):

              #import "C:\IE Copies\IE551-1\SHDOCVW.DLL"
              

              Doubt: As each of the 100 folders containing the IE5.5 have their own SHDOCVW.DLL, do I need to import them individually, or should this suffice? 3. After the IEs are running, next I need to "reach" their individual IWebBrowser2 interfaces (exposed by their SHDOCVW.DLL) so that I can invoke the navigation methods to automate visiting sites, logging in, etc. Please note - The IEs are *not* registered with the system (obviously) - and so the usual methods may not work. Doubt: Is there some way I can use CoCreateInstance() such that I can launch each of the IE5 copies, even though they're not registered on the system. Sorry - if this sounds crude/crazy... I'd really appreciate if you can suggest a solution to this -- or even a more appropriate/elegant method to get this going. Thanks a lot in advance, for your time & efforts. Rgds, nd

              modified on Thursday, June 5, 2008 2:31 PM

              J Offline
              J Offline
              Jorgen Sigvardsson
              wrote on last edited by
              #6

              Why do you need several processes? Can't you just instantiate one IE, and then automate it to open 100 new windows?

              -- Kein Mitleid Für Die Mehrheit

              N 1 Reply Last reply
              0
              • J Jorgen Sigvardsson

                Why do you need several processes? Can't you just instantiate one IE, and then automate it to open 100 new windows?

                -- Kein Mitleid Für Die Mehrheit

                N Offline
                N Offline
                Nirav Doshi
                wrote on last edited by
                #7

                The reason for several copies of IE is purely for the visiting site's session management. New Windows don't allow a new session as well as multiple copies of the same IEXPLORE binary (different process). Hence the need to make multiple self-sustained copies of IE. Thanks!

                * Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

                J 1 Reply Last reply
                0
                • N Nirav Doshi

                  The reason for several copies of IE is purely for the visiting site's session management. New Windows don't allow a new session as well as multiple copies of the same IEXPLORE binary (different process). Hence the need to make multiple self-sustained copies of IE. Thanks!

                  * Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

                  J Offline
                  J Offline
                  Jorgen Sigvardsson
                  wrote on last edited by
                  #8

                  Oh, I see.. tricky. Perhaps it would be easier to create 100 user accounts, and run each instance for each user? Might be trickier in some other respects. (Just throwing out some random ideas here that might be of some use :))

                  -- Kein Mitleid Für Die Mehrheit

                  N 1 Reply Last reply
                  0
                  • N Nirav Doshi

                    Stuck up once again! :( I've used the code & concept as given at: How to get IHTMLDocument2 from a HWND[^] With that, though I have a valid CComPtr<IHTMLDocument2> spHTMLDoc2, (valid because the spHTMLDoc2->put_bgColor(CComVariant("blue")) works fine) the get_parentWindow() doesn't work and gets a 0x00000000 in the spHTMLWindow2. Is there something wrong with the way I'm doing this?

                    spHTMLDoc2->put_bgColor(CComVariant("blue"));

                    CComPtr<IHTMLWindow2> spHTMLWindow2;
                    hr = spHTMLDoc2->get_parentWindow(&spHTMLWindow2);

                    Thanks!

                    * Blood donation is the most superior form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

                    modified on Saturday, June 14, 2008 2:16 AM

                    N Offline
                    N Offline
                    Nirav Doshi
                    wrote on last edited by
                    #9

                    Finally, a good friend (Nanda) was able to help with this, and got the code below WORKING! This is how to get IWebBrowser2 from IHTMLDocument2. Pasting code below for anyone who may need this. I had a very tough week wrestling with this, don't want anyone else to go through the same. :-)

                    CComQIPtr<IOleObject> spOleObject; // IOleObject
                    CComQIPtr<IOleClientSite> spOleClientSite; // IOleClientSite
                    CComQIPtr<IServiceProvider> spServiceProvider; // IServiceProvider
                    ...
                    ... // Code here as per How to get IHTMLDocument2 from a HWND[^]
                    ...
                    HRESULT hRes = spHTMLDoc2->QueryInterface(IID_IOleObject, reinterpret_cast<void **>(&spOleObject));
                    if (SUCCEEDED(hRes))
                    {
                    hRes = spOleObject->GetClientSite(&spOleClientSite);
                    if(SUCCEEDED(hRes))
                    {
                    hRes = spOleClientSite->QueryInterface(IID_IServiceProvider, reinterpret_cast<void **>(&spServiceProvider));
                    if(SUCCEEDED(hRes))
                    {
                    hRes = spServiceProvider->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2, reinterpret_cast<void **>(&spWebBrowser));
                    }
                    if(SUCCEEDED(hRes))
                    {
                    BSTR oURL;
                    oURL = SysAllocString(L"http://www.google.com");
                    VARIANT var;
                    var.vt = VT_EMPTY;

                    		spWebBrowser->Navigate((BSTR)oURL, &var, &var, &var, &var);
                    		SysFreeString(oURL);
                    	}
                    }
                    

                    }

                    Thanks a ton Nanda! :cool:

                    * Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

                    1 Reply Last reply
                    0
                    • J Jorgen Sigvardsson

                      Oh, I see.. tricky. Perhaps it would be easier to create 100 user accounts, and run each instance for each user? Might be trickier in some other respects. (Just throwing out some random ideas here that might be of some use :))

                      -- Kein Mitleid Für Die Mehrheit

                      N Offline
                      N Offline
                      Nirav Doshi
                      wrote on last edited by
                      #10

                      Thanks! Yes, that's what is to be done. 100 browsers, running 100 user accounts simultaneously, automated. :-)

                      * Blood donation is the superior'est form of donation, it can save lives. Celebrate special occasions, like your birthdays, by donating blood. *

                      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