469,621 Members | 1,678 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,621 developers. It's quick & easy.

makepy support for versioning

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:
car <win32com.gen_py.ScriptibleCoCar 1.0 Type Library.IDualCoCar2
instance at 0x17800328> person <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:
carOwner <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:
IID_IPerson2 = "{38332D31-6631-48E9-B62E-449864003395}"
carOwner._oleobj_.QueryInterface(IID_IPerson2) 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:
import win32com.client.dynamic
dcar = win32com.client.dynamic.Dispatch("ScriptibleCoCar. DualCoCar")
dperson = dcar.Person
dperson.Name, dperson.ID, dperson.Address # Address is new

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
Jul 18 '05 #1
0 1141

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Alv Mart | last post: by
3 posts views Thread by Gerson Kurz | last post: by
2 posts views Thread by Svenn-Ivar Svendsen | last post: by
1 post views Thread by Steve M | last post: by
1 post views Thread by Chris Curvey | last post: by
reply views Thread by Kai Rosenthal | last post: by
4 posts views Thread by suzhi18 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.