Note: This is all COM and ATL, no MFC, which is why I am trapping the events
through IDispatch..
Within my implementation of Invoke I am switching on the dispparams
parameter so I can trap the events. The one I am particularly interested in
at the moment is DISPID_NEWWINDOW2, which gets called when the Browser is
going to open a new window.
The brief documentation I have found about this says just return the
IDispatch of the current WebBrowser object. This is tried, without success.
This problem is bugging me now, any one out there know anything about
re-directing the Browser via the events trapped in Invoke. I would like to
re-use the existing browser and not open a new window.
Any ideas
Thanks
Steve Conner
"Stephen Conner" <steve...@hotmail.com> wrote in message
news:uyK717G...@cppssbbsa02.microsoft.com...
But, I got doing this ...
case DISPID_NEWWINDOW2:
{
// Sent when a New Window should be created ...
CComPtr<IDispatch> pIDispatch;
m_spIWebBrowser2->get_Application(&pIDispatch);
*(pDispParams->rgvarg[1].ppdispVal) = pIDispatch;
m_bRemainInWindow = TRUE;
break;
}
This then forces a call to the DISPID_BEFORENAVIAGTE2
If you don't redirect the URL in BEFORENAVIGATE2 then nothing happens so;
case DISPID_BEFORENAVIGATE2:
{
// If m_bRemainInWindow has been set then we know we are frigging a NewWindow request ....
if (m_bRemainInWindow)
{
m_bRemainInWindow = FALSE;
CComVariant varURL(*pDispParams->rgvarg[5].pvarVal);
varURL.ChangeType(VT_BSTR);
SetURL(varURL.bstrVal); // My Function .... Could Be m_spIWebBrowser2->Navigate2(...)
}
break;
}
Steve Conner
"Igor Tandetnik" <itand...@whenu.com> wrote in message news:#t#JrwHLA...@cppssbbsa02.microsoft.com...