We have an ATL application which hosts an IE browser.
We create the browser instance and subscribe to it as follows:
// TODO: Add your implementation code here
HRESULT hr = E_FAIL;
if (m_spIE == NULL) // Can only start one instance of IE4
// Create an instance of IE4 and get the IWebBrowser2 interface pointer.
// IWebBrowser2 represents the application as well as the WebBrowser control.
hr = CoCreateInstance(CLSID_Int
rer, NULL, CLSCTX_LOCAL_SERVER,//CLSC
// We want to see IE4 don't we???
cout<< " Registering for browser events " << endl;
hr = m_spIE->Navigate2(&vurl, &ve, &ve, &ve, &ve);
However the program exists before the documentcomplete is fired!!!So we try to capture the readystate property before returning from the method as follows:
} while (result != READYSTATE_COMPLETE);
But even then the program exits before documentcomplete is fired.
However if we keep the program running indefinitely,documentcompl
ete is fired ,and we can load the document tree.
What should we do to prevent the program from exitting before documentcomplete is fired? We have also tried get_statustext as Done with no avail.