Win32-COM pass by ref for long arguments

Discussion in 'Python' started by Victor Ng, Sep 24, 2004.

  1. Victor Ng

    Victor Ng Guest

    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?
     
    Victor Ng, Sep 24, 2004
    #1
    1. Advertising

  2. 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.
     
    Stephen Prinster, Sep 24, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Radde
    Replies:
    38
    Views:
    998
  2. Replies:
    0
    Views:
    341
  3. Replies:
    22
    Views:
    762
    peter koch
    Apr 30, 2008
  4. Replies:
    6
    Views:
    352
    James Kanze
    Apr 29, 2008
  5. Navindra Umanee

    strong ref from weak ref?

    Navindra Umanee, Feb 12, 2005, in forum: Ruby
    Replies:
    2
    Views:
    145
    Navindra Umanee
    Feb 12, 2005
Loading...

Share This Page