[python-win32] reliably controlling IE (Dispatch vs DispatchEx)

Mark Hammond mhammond at skippinet.com.au
Fri Dec 5 00:23:48 EST 2003


Dispatch() attempts to do a GetObject() before creating a new one.
DispatchEx() just creates a new one.  This is almost certainly the reason
for the different behaviour, and this won't change from Python's side of the
fence.

Mark.

> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org]On Behalf Of Greg Lee
> Sent: Friday, 5 December 2003 11:18 AM
> To: python-win32 at python.org
> Subject: [python-win32] reliably controlling IE (Dispatch vs
> DispatchEx)
>
>
> I'm using code like this to display text in IE from within a Tkinter
> application:
>
>            # magic argument list generated by makepy.py -i
> for Microsoft
> Internet Controls
>
> win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7E
> B-0000C05BAE0B}',
> 0, 1, 1)
>             self.iexplorer =
> win32com.client.DispatchEx('InternetExplorer.Application.1")
>             self.iexplorer.Visible = 1
>             self.iexplorer.Navigate(contents)
>             win32gui.ShowWindow(self.iexplorer.HWND, 1)   #
> winuser.h:SW_
>
> I'm using DispatchEx rather than the conventional Dispatch
> because I've
> noticed that if I have a Windows Explorer running and use
> Dispatch, then the
> contents sometimes appears in the right-hand pane of the
> Windows Explorer
> rather than in a new instance of InternetExplorer.  Using
> DispatchEx "seems"
> to do the right thing, but I'm reluctant to rely on this as a
> fix for an
> intermittent problem.  Any thoughts from the experts?
>
> There is a 4 August posting stating that DispatchEx was
> necessary when you
> want two instances of of IE, as in:
>         ie1 =
> Win32com.client.DispatchEx('InternetExplorer.Application.1')
>         ie2 =
> Win32com.client.DispatchEx('InternetExplorer.Application.1')
>
> _________________________________________________________________
> Browse styles for all ages, from the latest looks to cozy
> weekend wear at
> MSN Shopping.  And check out the beauty products!
http://shopping.msn.com


_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32




More information about the Python-win32 mailing list