Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2007 Jan : Ansynchronous IO dll notifications
| Subject: | Ansynchronous IO dll notifications |
| Posted by: | "gg" (g..@velleman.be) |
| Date: | Wed, 24 Jan 2007 10:29:08 |
I need some best practice advice from the more experienced developers
here.
I'm currently writing software for an oscilloscope, which sends its
trace data asynchoneously over a serial port interface to a computer.
All the code to achieve this is written in Delphi, without too much
trouble. This works OK.
Now, I'd like to provide a better solution in the form of a library
(dll) that does everything in regards to the scope, but can be used by
any other programming languages. My problem lies in how notify the
application when trace data is ready and how to transfer the trace data
from the dll to the application.
Do I:
a) Use message notifications by passing a window handle to my dll, eg.
SendMessage(scopeStruct.hWnd, WM_TRACE_RCV), with LPARAM or WPARAM
pointing to the buffer and its size.
b) Use a callback function (function pointer) that is called whenever a
trace is ready, eg. trace_rcv(BYTE*lpData, size_t size),
scopeStruct.lpTraceProc = trace_rcv
c) Same as a°, but without passing the buffer in WPARAM or LPARAM,
instead providing some sort of GetData function where you pass in your
own buffer to copy the data into, eg. GetData(scopeStruct, myOwnBuffer).
Basically it comes down to this:
- Callback or message notification
- Own buffer or not
I could then make a Delphi wrapper for the dll functions and recreate my
application.
Thanks in advance,
Gunther VB