I am not sure I follow you.

What I did was:

-----------------------------------------------------------------------------------------------------------------------
>>> wo = pythoncom.New('InternetExplorer.Application')
>>> import win32com.client
>>> w = win32com.client.Dispatch(wo)
>>> w.Navigate('http://google.com')
>>> doc = w.Document
>>> wo.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
pywintypes.com_error: (-2147467262, 'No such interface supported', None,
None)

>>> w.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<COMObject <unknown>>", line 2, in QueryInterface
pywintypes.com_error: (-2147352573, 'Member not found.', None, None)

-----------------------------------------------------------------------------------------------------------------------

Am I missing something? Why does it simply complain that this interface is
not supported? It's indeed supported from MSDN document...

Thanks,
xin

On Thu, May 27, 2010 at 11:25 AM, Tim Roberts <t...@probo.com> wrote:

> Xin Zhao wrote:
> > Thanks for your kind reply.
> >
> > I tried the new iid, doesn't help. :(
> >
> > >>> import pythoncom
> > >>> wo=pythoncom.New('InternetExplorer.Application')
> > >>> wo.QueryInterface('{3050f485-98b5-11cf-bb82-00aa00bdce0b}')
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > pywintypes.com_error: (-2147467262, 'No such interface supported',
> > None, None)
> >
> > Any further idea?
>
> Yes.  The Internet Explorer application doesn't support that interface,
> because a single IE instance can have multiple documents.  "wo" will be
> an instance of IWebBrowser2.  You need to fetch a document from that
> interface, then fetch the IHTMLDocument3 interface from that.  You want
> the Document property, which is either:
>    doc = wo.Document
> or
>    doc = wo.get_Document()
>
> That "doc" object should be an IHTMLDocument2.  If you really need the
> "...3" version, that's where you do the QueryInterface.
>
> --
> Tim Roberts, t...@probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to