How to capture events fired from new IE popup

Hello!

Situation:

My ActiveX DLL contains a customizable web browser. The web browser displays the web page. When the user clicks on a link on the displayed page, a new IE window pops up and navigates to the URL with the click.

Question:

How can I capture the DocumenComplete and NavigateComplete events emitted from the IE NEW popup ?

What I've already tried:

I tried to capture the * NewWindow2 (IDispatch ** ppDisp, VARIANT_BOOL Cancel) event thrown from a custom web browser (not a new IE window) and got a ppDisp pointer that points to the new IE windown. I tried to use this pointer as an event source to communicate or hook into an event handler (IDispatch :: Invoke) to capture the event. However, this will not work. The crash may be caused by the document in the new IE window not being loaded yet. I'm not sure.

Could you give me a suggestion what should I do?

Thanks!

0


a source to share


2 answers


You will not get a new web browser in ppDisp. You create one, receive events and return your application property to ppDisp for the event.



+1


a source


void CYourDlg::OnNewWindow2(LPDISPATCH FAR* ppDisp, BOOL FAR* Cancel)
{
  CDlgNewWB* dlgNewWB = new CYourDlg;
  this.listDialogWeb.Add(dlgNewWB);
  dlgNewWB ->Create(IDD_WBDLG_DIALOG);

  dlgNewWB ->m_webBrowser.SetRegisterAsBrowser(TRUE);

  *ppDisp = dlgNewWB ->m_webBrowser.GetApplication();

      



}

+1


a source







All Articles