468,304 Members | 1,440 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,304 developers. It's quick & easy.

Python COM and Delphi callback

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
May 2 '07 #1
0 973

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Francois De Serres | last post: by
2 posts views Thread by Huseyin Altun | last post: by
46 posts views Thread by Kamilche | last post: by
2 posts views Thread by Jon E. Scott | last post: by
2 posts views Thread by Larry Bates | last post: by
1 post views Thread by durumdara | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.