[python-win32] QueryInterface fails with object passed from VB

jose simas josesimas at gmail.com
Sun Apr 27 12:18:13 CEST 2008


Hi Mark,

Thanks for the answer, I tried using the IViewDataView's uiid like
this (probably in a naive way):

y = view.QueryInterface("{8D2AD79B-1ADD-4181-BAD4-FF0672A9B6E3}")

But that produces the error on that line.

com_error: (-2147221005, 'Invalid class string', None, None)

I read that I can do the same thing with win32com (without using
comtypes) but for that I would need to somehow add my custom interface
to it. I also read that exist tools to automate this process but so
far I could not find them. Where should I start?

Cheers
Jose


On Sun, Apr 27, 2008 at 8:07 AM, Mark Hammond <mhammond at skippinet.com.au> wrote:
> >         import comtypes.gen.ResultsInterfaces as ResInt
> >         internalView = view.QueryInterface(ResInt.IViewDataView)
>
> ResInt.IViewDataView needs to be converted to either a pywintypes IID
> object, or a string in {xxx-xxx-etc} format - but I'm not sure how to
> convert between comtypes IIDs and pywintypes IIDs.
>
> Mark
>
>


More information about the python-win32 mailing list