Python COM and Delphi callback

Discussion in 'Python' started by Larry Bates, May 2, 2007.

  1. Larry Bates

    Larry Bates Guest

    I have a Python COM object working. I want to pass to it
    a Delphi callback function (showing progress) that I can
    call periodically. I've Googled until I'm cross-eyed and
    I'm getting nowhere. Anybody out there that could give
    me a push in the right direction.

    I tried passing pointer to my callback function using
    @ operator in Delph, but when I compile Delphi complains.

    Here is a snip of my Delphi code:

    function Callback(total: integer; position: integer): boolean; stdcall;
    begin
    WriteLn('In Callback, total=' + IntToStr(total) +
    ' position=' + IntToStr(position));
    result := True;
    end;

    ..
    .. In program
    ..
    //
    // Set callback function in wsAPI to be called for each block
    // that is uploaded. oC contains instance of COM object and
    // works perfectly. oC has a method called WSset_callback that
    // expects a callback function as an argument. I have the
    // callback working perfectly in pure-Python code.
    //
    oC.WSset_callback(@Callback);

    When I compile I get:

    [Pascal Error] wsAPICOM.dpr(151) E2281 Type not allowed in Variant
    Dispatch call.

    Thanks in advance for any assistance.

    Regards,
    Larry
     
    Larry Bates, May 2, 2007
    #1
    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. PythonMan

    Any Software can Python <-> Delphi ?

    PythonMan, Jul 28, 2003, in forum: Python
    Replies:
    3
    Views:
    559
    Brad Clements
    Jul 29, 2003
  2. Dang
    Replies:
    4
    Views:
    1,054
    Dang Griffith
    Oct 15, 2003
  3. John Tiedeman

    Delphi/Kylix and Python

    John Tiedeman, Dec 2, 2004, in forum: Python
    Replies:
    1
    Views:
    360
    Tim Roberts
    Dec 5, 2004
  4. Kristofer Carlson

    Python and Delphi

    Kristofer Carlson, Dec 24, 2004, in forum: Python
    Replies:
    1
    Views:
    373
    Jarek Zgoda
    Dec 24, 2004
  5. Replies:
    1
    Views:
    410
    Diez B. Roggisch
    Jul 28, 2008
Loading...

Share This Page