Launching multiple IE [modified]
-
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 useCoCreateInstance()
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, ndmodified on Thursday, June 5, 2008 2:31 PM
-
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 useCoCreateInstance()
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, ndmodified on Thursday, June 5, 2008 2:31 PM
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 theCreateProcess()
which will get me only the PID. Phew... I hope this works! Yet to test it. Thanks, nd -
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 useCoCreateInstance()
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, ndmodified on Thursday, June 5, 2008 2:31 PM
#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
-
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 theCreateProcess()
which will get me only the PID. Phew... I hope this works! Yet to test it. Thanks, ndStuck 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 thespHTMLDoc2->put_bgColor(CComVariant("blue"))
works fine) theget_parentWindow()
doesn't work and gets a0x00000000
in thespHTMLWindow2
. 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
-
#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
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. *
-
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 useCoCreateInstance()
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, ndmodified on Thursday, June 5, 2008 2:31 PM
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
-
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
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. *
-
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. *
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
-
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 thespHTMLDoc2->put_bgColor(CComVariant("blue"))
works fine) theget_parentWindow()
doesn't work and gets a0x00000000
in thespHTMLWindow2
. 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
Finally, a good friend (Nanda) was able to help with this, and got the code below WORKING! This is how to get
IWebBrowser2
fromIHTMLDocument2
. 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. *
-
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
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. *