[python-win32] Can win32com handle this one?

Tim Roberts timr at probo.com
Mon Feb 4 20:02:00 CET 2008


David Abrahams wrote:
> I have a couple of type libraries that I've run makepy on.
>
> The first can be loaded with 
>
>   s = win32com.client.Dispatch('nameof.Lib1')
>
> I have verified that the above gets the ILib1Session object, which
> the documentation for that library says is the entry point for
> everything.
>
> The documentation then states I'm to call the GetProvider method to get
> an instance of ILib2Provider, which, naturally, is defined in Lib2.  The
> GetProvider method is declared thus:
>
>   HRESULT GetProvider (
>    ILib2Provider   **ppProvider)
>
> When I do 
>
>   s.GetProvider() 
>
> in Python, I get a PyIUnknown object.  No QueryInterface call I have
> been able to manufacture will get me an ILib2Provider object.
>   

Actually, you DO have an ILib2Provider object, wrapped in Python by 
PyIUnknown.  You should be able to call the methods and properties of 
ILib2Provider using that object.

Python doesn't know it's an ILib2Provider, because that's just a name 
used in the C++ source code, but the methods and properties should all 
be there.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list