Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Win32-COM pass by ref for long arguments

Reply
Thread Tools

Win32-COM pass by ref for long arguments

 
 
Victor Ng
Guest
Posts: n/a
 
      09-24-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?
 
Reply With Quote
 
 
 
 
Stephen Prinster
Guest
Posts: n/a
 
      09-24-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Having compilation error: no match for call to (const __gnu_cxx::hash<long long int>) (const long long int&) veryhotsausage C++ 1 07-04-2008 05:41 PM
passing ref to ptr again as ref to ptr.... osama178@gmail.com C++ 22 04-30-2008 10:42 AM
passing ref to ptr again as ref to ptr.... osama178@gmail.com C++ 6 04-29-2008 08:09 AM
passing ref to ptr again as ref to ptr.... osama178@gmail.com C++ 0 04-24-2008 08:23 PM
pass by ref vs pass by pointer Radde C++ 38 08-23-2005 06:29 PM



Advertisments