[python-win32] Com questions.

Mark Hammond skippy.hammond at gmail.com
Mon Dec 7 04:05:00 CET 2009


On 7/12/2009 6:08 AM, Tom Pacheco wrote:
>
> how do you manually wrap a com object with an makepy generated class?
>
> dyobj = win32com.client.GetObject('DynamicClassName')
> dyobj is a dynamic and i cant call ref returning functions with it.
>
> i have TLB file for interface it supports i ran makepy on it and can
> load the module.
> ifmod = win32com.client.gencache.GetModuleForTypelib(typelibCLSID, lcid,
> major, minor)
>
> is it as simple as:
> pyobj = ifmod.InterfaceClassName(dyobj._oleobj_)

Yep.

> is there a way to list the names in the gencache?
> ie..
> 'Word.Application'
> 'Excel.Application'

Nope.  In many cases the typelib (and therefore the generated file) 
isn't aware of what names are used to create it.

> how do you get the guid from _oleobj_?

Similarly, I don't think you can in all cases (but it may be possible if 
the object is actually a CoClass)

Cheers,

Mark


More information about the python-win32 mailing list