Problem in event NewWindow2



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

.



Relevant Pages

  • Re: Custom Outlook Form with Web Browser Control
    ... Have the recipient add the Message Class field to the view. ... Author of Microsoft Outlook 2007 Programming: ... does including a web browser ... web browser control doesn't automatically one-off the form, ...
    (microsoft.public.office.developer.outlook.forms)
  • Re: Display XML in WebBrowser Control
    ... XML to the web browser control and have the web browser conrol ... automatically apply its stylesheet for XML tree pretty printing. ... That is why I told the original poster that he can of course ...
    (microsoft.public.dotnet.xml)
  • Re: Custom Outlook Form with Web Browser Control
    ... Sue Mosher, Outlook MVP ... does including a web browser ... web browser control doesn't automatically one-off the form, ...
    (microsoft.public.office.developer.outlook.forms)
  • Re: Custom Outlook Form with Web Browser Control
    ... Sue Mosher, Outlook MVP ... does including a web browser ... web browser control doesn't automatically one-off the form, ...
    (microsoft.public.office.developer.outlook.forms)
  • Re: ATTN Conlan, Mikey and everyone
    ... in marker on your monitor won't have worked.. ... Confusing, I know, but if you close your web browser now you'll probably still see your signature on the screen. ...
    (uk.sport.football)

Loading