You can pass byref parameters only in late-bound (pygen) COM.

The current value of the byref parameters will be pass in as normal.
To return the new result, return a tuple from the function containing
the normal return value, if any, along with a value for each byref
parameter.

For example:

   # implementing com method "int foo(int a, int b, [in,out] int c)"

   def foo(a, b, byrefC)
     ...
     byrefc = b-a # only changes local copy
     ...
     return a*b, byrefC+1  # a*b is int return value, (b-a)+1 is new byref
value

mike

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Bob
Kline
Sent: Saturday, August 04, 2001 1:04 PM
To: [EMAIL PROTECTED]
Subject: How to pass "byref" parameters to COM object methods


I don't see any way, reading through the documentation for using COM as
a client from the ActiveState distribution of Python, to pass an
argument to a method of a COM object in such a way that the method can
set the value of the argument.  I expected to see something like the
ability to create an object of a Variant class, which I would think
would be the cleanest approach (as opposed to something like passing a
list with one member), but can't find anything along these lines.

An example of where such a mechanism is needed is the Execute() method
of the ADO Connection object.  Microsoft uses the RecordsAffected
parameter to return the count of rows affected by the operation
performed.

I assume I'm just not looking in the right place.  Could someone kindly
point me to the appropriate section of the ActiveState documentation?
Thanks very much.

--
Bob Kline
mailto:[EMAIL PROTECTED]
http://www.rksystems.com

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to