makepy support for versioning

J

Jim Kerr

Does makepy always respect versioning of interfaces? It appears as
though makepy correctly handles versioning of objects you obtain
directly, but not for objects you get via a function call.

Here's a simple example to illustrate the point. I created the
C++-based server for this example by pilfering some code in Andrew
Troelsen's book on COM and ATL.

car = Dispatch("ScriptibleCoCar.DualCoCar")
person = Dispatch("ScriptibleCoCar.Person") # a Person object
carOwner = car.Person # also a Person
object

Both the Car and the Person classes have two versions, and makepy
handles this correctly:
<win32com.gen_py.ScriptibleCoCar 1.0 Type Library.IDualCoCar2
instance at 0x17800328> <win32com.gen_py.ScriptibleCoCar 1.0 Type Library.IPerson2
instance at 0x17800368>

(Notice the suffix 2 in both cases). OTOH, the Person object obtained
via car.Person is a version 1 thingie:
<win32com.gen_py.ScriptibleCoCar 1.0 Type Library.IPerson
instance at 0x14968112>

If I try to use QueryInterface to get a reference to a version 2
object, it fails:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: There is no interface object registered that supports
this IID

Late binding works fine, however:
in version 2
(u'Phony', 123, u'00 Anywhere Place')

I'm kinda stuck here. I could live with using late binding, but the
interface I need to use has a lot of properties with parameters, and
makepy seems like the easiest way to deal with those. So my questions
are:
1) Is there a way around this issue with makepy?
2) If not, is there a way to set the values of properties with
parameters using late binding?

Thanks for the help!

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top