Win32-COM pass by ref for long arguments

Victor Ng crankycoder at gmail.com
Fri Sep 24 16:05:55 EDT 2004


Hi everyone, 

I'm trying to use Python to talk to some COM components but I can't
figure out how the pass-by-ref works in PythonWin.

The COM signature I'm trying to call is:

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

I've successfully made calls to other functions in the COM library
from Python - so I'm fairly certain that things _should_ be working.

My call is using an initial value of pythoncom.Empty for hTableRef,
but I'm getting the following stacktrace from within the PythonCOM
library:
  
File "test.py", line 52, in ?
    tableRef = cf.OpenTable(result, 36)
  File "C:\Python23\Lib\site-packages\win32com\gen_py\9F78D5E0-A1B3-11CF-AF9F-00030F8047D7
x0x1x0.py", line 315, in OpenTable
    return self._oleobj_.InvokeTypes(48, LCID, 1, (11, 0), ((16387,
0), (3, 0)),hTableRef,
 TableNo)
pywintypes.com_error: (-2147352571, 'Type mismatch.', None, 1)

Anyone know what's going on here?



More information about the Python-list mailing list