473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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 1128

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Edilmar | last post by:
Hi, First of all, I'm new in Python... I have worked with manu langs and IDEs, like Delphi, VB, JBuilder, Eclipse, Borland C++, Perl, etc... Then, today I think IDEs like Delphi have a...
30
by: Christian Seberino | last post by:
How does Ruby compare to Python?? How good is DESIGN of Ruby compared to Python? Python's design is godly. I'm wondering if Ruby's is godly too. I've heard it has solid OOP design but then...
5
by: Francois De Serres | last post by:
Hiho, could somebody please enlighten me about the mechanics of C callbacks to Python? My domain is more specifically callbacks from the win32 API, but I'm not sure that's where the problem...
2
by: Huseyin Altun | last post by:
I have DLL written in Delphi 6. Its prototype is below: function EnumUserGroups(Proc: TEnumUserGroupProc; APtr: Pointer): LongInt; stdCall; I have declared it in c# like below: (VS 2003) ...
46
by: Kamilche | last post by:
I switched to Python a couple years ago, and haven't looked back. I've used Python for many applications, including several commercial plugins for Poser. I don't post on here much, because I don't...
2
by: Jon E. Scott | last post by:
I've got a project where I need to create a C# project and a Delphi DLL, in which the DLL has a callback function to send statuses back to the C# application. It seems pretty straightforward in a...
2
by: Larry Bates | last post by:
I have a rather large Python class that I've converted to a COM object. I can dispatch (using either Python or VB) and call the methods perfectly. Now a new client wants to call it from Delphi. ...
0
by: Tim Spens | last post by:
--- On Fri, 6/27/08, Tim Spens <t_spens@yahoo.comwrote: I think I know where the problem is but I'm unsure how to fix it. When I call Register_Handler(...) from python via...
1
by: durumdara | last post by:
Hi! I have a component, and a tool in Delphi. I wanna call it from Python. I can implement all things I need into a Delphi generated DLL. It is ok, I can use this DLL from Python, but the DLL...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.