[python-win32] reliably controlling IE (Dispatch vs DispatchEx)
Greg Lee
gphst at hotmail.com
Thu Dec 4 19:18:18 EST 2003
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-A7EB-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
More information about the Python-win32
mailing list