Win32-COM pass by ref for long arguments

vng1 at mac.com vng1 at mac.com
Sat Sep 25 11:05:09 EDT 2004


I figured it out eventually.  It wasn't  clear from any of the 
Python/COM documentation that pass byref variables are returned as 
'extra' values in the return value.

So a COM function like:

Function OpenTable(ByRef hTableRef As Long, ByVal TableNo As Long) As 
Boolean

becomes translated to this:

def OpenTable( discardedhTableRef, tableNo):
	# COM bridge does stuff here
	return (boolResult, hTableRef)

Well - it wasn't obvious to _me_ anyway.

vic

On 24-Sep-04, at 04:16 PM, Stephen Prinster wrote:

> Victor Ng wrote:
>> My call is using an initial value of pythoncom.Empty for hTableRef,
>> but I'm getting the following stacktrace from within the PythonCOM
>> library:
>>
> Have you tried pythoncom.Missing instead of pythoncom.Empty?  I don't 
> know what the difference is, but I remember seeing a comment in a 
> makepy-generated file about trying both because sometimes one works 
> better than the other.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3901 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040925/9a68f93b/attachment.bin>


More information about the Python-list mailing list