Win32-COM pass by ref for long arguments

V

Victor Ng

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?
 
S

Stephen Prinster

Victor said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top