Win32/COM - returning multiple values

Mark Hammond mhammond at skippinet.com.au
Tue May 9 22:39:18 EDT 2000


"Richard Brodie" <R.Brodie at rl.ac.uk> wrote in message
news:8f9brb$pps at newton.cc.rl.ac.uk...

> One of the methods naturally returns an int and two strings. Now, I
> had naively thought that these would be returned as an array.

They would - sort-of - it would be a tuple.  Thus you should be able to
say:

i, s1, s2 = ob.YourMethod()

> However, it seems that what I have to do is to use NewEnum to
> coerce it to an IEnumVARIANT interface, and then use
> QueryInterface and Next on the client to recover the array.

It sounds like the object is returning a collection.  No idea why.  By
byref args generally work fine, especially if you have run "makepy".

> Lucky I was able to protoype this all in Python ;)  Have I really
> got to jump through all these hoops though?

If you really do need to, it shouldnt be Python specific.

If you can post the code in your .idl, I will have a better idea...

Mark.





More information about the Python-list mailing list