473,325 Members | 2,608 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,325 software developers and data experts.

Callback Python procedure from Delphi DLL

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 procedure needs a
callback procedure to return the partially output, and needs a python
passed variable to check terminate/abort signal.

For example:
procedure ProcessFiles(InputFiles : string; CallBackProc:
????????????????????????); export;
begin
....
CallBackProc(ProcessedFiles, Percentage, NeedToAbort);
if NeedToAbort then Exit;
....
end;
def CallBackProc(ProcessedFiles, Percentage, NeedToAbort):
...

But I don't know, how to call back this procedure, and how to pass
variables.

The other way is a ActiveX.
This time I don't load the DLL, I only construct the Delphi based Com
Object, and I start the process.

But in this way I also don't know how to implement the callback, because
the main code uses callback events, and I need to use too...

Thanks for every usable help!
dd
Jul 28 '08 #1
1 2985
du*******@gmail.com wrote:
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 procedure needs a
callback procedure to return the partially output, and needs a python
passed variable to check terminate/abort signal.

For example:
procedure ProcessFiles(InputFiles : string; CallBackProc:
????????????????????????); export;
begin
....
CallBackProc(ProcessedFiles, Percentage, NeedToAbort);
if NeedToAbort then Exit;
....
end;
def CallBackProc(ProcessedFiles, Percentage, NeedToAbort):
...

But I don't know, how to call back this procedure, and how to pass
variables.

The other way is a ActiveX.
This time I don't load the DLL, I only construct the Delphi based Com
Object, and I start the process.

But in this way I also don't know how to implement the callback, because
the main code uses callback events, and I need to use too...

Thanks for every usable help!
ctypes allows to create callbacks. See the module-docs.

Diez
Jul 28 '08 #2

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...
5
by: AMD | last post by:
Hi, I need to write a Win32 DLL and I would like to use Python instead of VB, C++ or Delphi. Is this possible? Thank you, Andre M. Descombes
0
by: Tom | last post by:
delphi 7 python 2.3 win98 Python for Delphi V3.25 In Delphi: 1 Create a new Form ; 2 Drop a TMemo(Memo1) to contain python code; 3 Drop a TPythonInputOutput (PythonInputOutput1) ;
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: 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...
5
by: sajin | last post by:
Hi All.. We are using VB .Net 2005 for implementing an API. API needs to generate events. For this client wants us to use Windows Callback (delegate implementation). The intention of using...
0
by: Larry Bates | last post by:
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. ...
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...
19
by: Dotan Cohen | last post by:
I often see mention of SMBs that either want to upgrade their Windows installations, or move to Linux, but cannot because of inhouse VB apps. Are there any Python experts who I can reference them...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.