Hi,
I programmed test program that navigate url with "Navigate()" method of BHO (Browser Helper Object).
And, I saw the url page successfully.
But, some page is wrong.
In example, "sign in" page in this site:
- Some frames in the page have scroll bar.
- Login procedure is failed.
(Without my BHO code, the original page has no scroll bar, and login procedure is good.)
My test code is very simple as follows:
This method "OnBeforeNavigate2()" is called when the event "DISPID_BEFORENAVIGATE2" is received in the method "Invoke()".
======= start of code =======
BOOL CSWATHelper::OnBeforeNavigate2(DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep, UINT *argerr)
{
USES_CONVERSION;
HRESULT hr = S_FALSE;
CComPtr<IWebBrowser2> spBrowser;
CComPtr<IDispatch> spDisp = ((*params).rgvarg)[ 6 ].pdispVal;
hr = spDisp->QueryInterface(IID_IWebBrowser2,(void**)&spBrowser);
if (hr != S_OK) {
return TRUE;
}
// Variable "bSentAlrady" is flag to prevent infinite loop.
// If it is "TRUE", then this event is caused from the below "spBrowser->Navigate()" method.
// So, in this time, just return.
if (bSentAlready != FALSE) {
bSentAlready = FALSE;
return TRUE;
}
// Stop navigate.
spBrowser->Stop();
// Set the flag to "TRUE" for preventing infinite loop.
bSentAlready = TRUE;
// navigate to original url (for just test).
spBrowser->Navigate((*params).rgvarg[ 5 ].pvarVal->bstrVal, NULL, NULL, NULL, NULL);
return FALSE;
}
======= end of code ========
The above method is called when the event "DISPID_BEFORENAVIGATE2" is received.
And, it is just navigate to original url. It looks like very simple.
What' the matter What should I do
I spent several months on the above problem.
I really appreciate any one advice me.
Regards
Hyun.