Problem in event NewWindow2
- From: daniel.mes@xxxxxxxxx
- Date: Tue, 02 Oct 2007 05:01:24 -0700
Hi,
I'm using the Web browser control, creating it with CoCreateInstance
(CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (LPVOID*)&pWebBrowser))
, and monitoring events with the DWebBrowser2Events
(AtlAdvise(pWebBrowser, m_pInternetExplorerEventHandler,
DIID_DWebBrowserEvents2, &m_dwCookie)).
This is working fine;
I would like in the event NewWindow2, to create another web browser
control with CoCreateInstance and monitor its events as well.
I've written this code, (more or less the same code than for the first
created web browser)
void CInternet::NewWindow2(IDispatch **ppDisp, VARIANT_BOOL &Cancel)
{
/* Intercept the creation process. */
CComPtr<IWebBrowser2> pWebBrowser;
HRESULT hRes = CoCreateInstance (CLSID_InternetExplorer, NULL,
CLSCTX_SERVER, IID_IWebBrowser2, (LPVOID*)&pWebBrowser);
m_pInternetExplorerEventHandler = new
CInternetExplorerEventHandler();
AtlAdvise(pWebBrowser, m_pInternetExplorerEventHandler,
DIID_DWebBrowserEvents2, &m_dwCookie);
//pWebBrowser->put_RegisterAsBrowser(VARIANT_TRUE);
//pWebBrowser->put_Visible(VARIANT_TRUE);
/* Attach our instance. */
CComPtr<IDispatch> pDisp;
pWebBrowser->get_Application(&pDisp);
*ppDisp= pDisp;
}
But It seems that it's not the web browser i've created that is
launched, and i can't monitor its events... How can i handle this ? I
can't figure out what's the matter...
Thanks for your help
Daniel
.
- Follow-Ups:
- Re: Problem in event NewWindow2
- From: Igor Tandetnik
- Re: Problem in event NewWindow2
- Prev by Date: Re: adding toolbar on IE status bar
- Next by Date: Re: Problem in event NewWindow2
- Previous by thread: Re: adding toolbar on IE status bar
- Next by thread: Re: Problem in event NewWindow2
- Index(es):
Relevant Pages
|
Loading