Recent

Author Topic: fpc and dde  (Read 2068 times)

peverix

  • Newbie
  • Posts: 2
fpc and dde
« on: December 23, 2015, 09:30:57 am »
Hello

I try to convert a delphi 7 program that acts as a dde client to communicate with a dde server from another company.

It is a command line util.
I need to use the dde callback function to know when the action is finished by the other program.
I ported parts of TDDEClientConv to fpc and the dde server receives the ExecuteMacros that i send.

I addes a while loop to wait , but i don't receive the callback. Proberly i need to procces the windows message queue for this ?
Don't know how to do this.

Parts of my code

function DDECallback(CallType, Fmt: UINT; Conv: HConv; hsz1, hsz2: HSZ;
      Data: HDDEData; Data1, Data2: DWORD): HDDEData; stdcall;
begin
 writeln('DDECallback');
 writeln('Fmt' + inttostr(Fmt));
end;


function TDDEClient.Initialise(dwFlags: DWord) : boolean;    
var
  Res: UINT;   
begin
  dwInst:=0; 
  Res:=DdeInitialize( @dwInst, DdeCallback, dwFlags, 0);   
  Result := (Res = DMLERR_NO_ERROR);
end;

Thanks
Peter