catching msie NewWindow2 event

Roger Upole rupole at hotmail.com
Wed Jan 14 05:53:17 EST 2004


You have to return the out parameters.
Try adding
      return ppDisp,True
  to the bottom of OnNewWindow2.

      Roger

"mic" <aldo123 at onet.pl> wrote in message news:bu146d$66p$1 at news.atman.pl...
> I'm trying to catch the MSIE NewWindow2 event using win32com interface.
The
> code I use is basically something like below:
>
> from win32com.client import DispatchWithEvents
>
> class Events:
>     Browser = None
>     def OnNewWindow2(self, ppDisp, Cancel):
>         #catching the new window and trying to place it onto my own
>         ppDisp = Events.Browser
>         #Cancel = True - this doesn't work either (should prevent popup
from
> opening)
>
> ie1 = DispatchWithEvents('InternetExplorer.Application', Events)
> ie2 = DispatchWithEvents('InternetExplorer.Application', Events)
> Events.Browser = ie2
> ie1.Navigate('http://jaak.sav.net/test.html') #url to the html document
that
> opens its own window
>
> I know that setting ppDisp value should work (at least I've seen it
working
> in C# code) but using it this way gives no results. What's more depending
on
> the url I use the event is triggered or not (other standard events work
> okay). I've seen ctypes COM implementation demo that makes similiar things
> but it looks so much more complicated than win32com api. Hope somebody has
> some insight on that...
>
> Regards,
>
> Michal
>
>





More information about the Python-list mailing list