[python-win32] QueryInterface woes
Mark Hammond
mhammond@skippinet.com.au
Thu, 13 Feb 2003 08:35:15 +1100
If you grab the latest win32all, you will find a "CastTo" method. This can
be used like:
richitem = win32com.client.CastTo(item, "IRichTextItem")
This will perform the name lookup, and do the QI for you, and should give
the same result as Jen's advice.
Mark.
> -----Original Message-----
> From: python-win32-admin@python.org
> [mailto:python-win32-admin@python.org]On Behalf Of Steven Scott
> Sent: Wednesday, 12 February 2003 9:22 AM
> To: python-win32@python.org
> Subject: [python-win32] QueryInterface woes
>
>
> I'm connecting to Domino through it's COM interface with
> PythonCOM, and I've
> been able to do everything I need to until now.
> I have a method which returns an object of type IItem. Well,
> the Domino COM
> interface has this method. IItem has a "subclass" (I'm not
> up on all the
> fancy COM terminology) called IRichTextItem. I need to take
> the result of
> this method, which is an IItem, and call methods on it which
> only exist in
> IRichTextItem (yes, it is really an IRichTextItem). anyway,
> the COM people
> around here say that I need to use QueryInterface to get the richtext
> interface as opposed to just the regular item.
>
> How do I go about this?
>
> So far I've tried messing around with my object, and calling
>
> body._oleobj_.QueryInterface()
>
> with different stuff. Pretty much anything I put in resulted
> with some
> error about it not being able to find that IID, or something.
> I went into
> the gen_py directory and got the Domino file, and tried QI() with the
> IRichTextItem CLSID (in the form
> '{29131574-2EED-1069-BF5D-00DD011186B7}')
> and in this case I get the error "There is no interface
> object registered
> that supports this IID".
>
> anyway I'm really at a loss, any help would be appreciated.
>
> --
> Steven Scott [Bodoni26@resnet.gatech.edu]
> Don't give up fighting, 'til nothing else stands in your way..Don't
> give up talking, until there's nothing left to say....But no matter
>
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32