[Lazarus] Windows DDE
Daithi Haxton
dave at haxton.org
Sat Nov 9 15:53:29 CET 2013
I have finally convinced my boss to have a look at Lazarus and start
migrating our applications away from MFC ... but ....
We are Windows only, currently shipping Win7. I'm using Lazarus 1.0.10
with the bundled FPC - relatively recent. Our applications control and
communicate with various industrial devices via Dynamic Data Exchange
(DDE), using Microsoft's Dynamic Data Exchange Management Library
(DDEML). Delphi in all incarnations has had DDE controls - they're
pretty much just simple WinAPI calls, so I figured I could port them
rather painlessly.
A week and a half later I'm sending this message - hope someone can
help.
The basic problem seems to be in passing a string to a function in
Windows called DdeCreateStringHandle. It's already got a def in the
win32 tree in Free Pascal - basically this:
function DdeCreateStringHandle(Inst: DWORD; psz: PChar; CodePage:
Integer): HSZ; stdcall;
It doesn't seem to matter how I call it, it always registers a null
string. I call it like this:
ServiceHSz:= DdeCreateStringHandle(Inst, StringName, CP_WINANSI);
where StringName is a const PChar and Inst is a handle returned from
the DDEInitialize function (which I know is valid by monitoring with
other tools). This is basically identical to the VCL from Delphi 7 and
prior - it works find there but not with FreePascal. I'm compiling
with Delphi mode on and get no compilation errors.
DDE works on shared memory very much like the clipboard. I'm wondering
if there's something amiss in that regard, but am at my wits end.
Any ideas are appreciated!
Thanks,
Dave H.
More information about the Lazarus
mailing list