Modify the code in ddeman.pas as follows.
function DdeMgrCallBack(CallType, Fmt: UINT; Conv: HConv; hsz1, hsz2: HSZ;
Data: HDDEData; Data1, Data2: DWORD): HDDEData; stdcall;
var
ci: TConvInfo;
ddeCli: TComponent;
ddeSrv: TDdeSrvrConv;
ddeObj: TComponent;
xID: Integer;
begin
Result := 0;
case CallType of
XTYP_CONNECT: Result := HDdeData(ddeMgr.AllowConnect(hsz2, hsz1));
XTYP_WILDCONNECT: Result := ddeMgr.AllowWildConnect(hsz2, hsz1);
XTYP_CONNECT_CONFIRM: ddeMgr.Connect(Conv, hsz1, Boolean(Data2));
end;
if Conv <> then
begin
ci.cb := sizeof(TConvInfo);
// FIX TO BUG - COMMENT OUT NEXT 3 LINES
// if CallType = XTYP_XACT_COMPLETE then
// xID := Data1
// else xID := QID_SYNC;
On 25 March 1999, David Boissy confirmed that this bug still existed in Delphi 4.03,
but that the above mentioned fix does not work for him.
Any further information (confirmation/denial; explanation) to this is welcomed.
And here is some:
On 2 July 1999, Randy Shaw submitted the following:
Found a possible fix for bug # 22 on Deja News.
I just typed in DdeSetUserHandle for the keywords and *delphi* for the forum
and found this fix by Chad Crawley way back in March of 1997.
I'm successfully using this fix with version 3.02 of delphi but he was using it for
version 2 so I suspect this will work for all versions from 2
to 3.02 but I have not confirmed this. The bug fix on your site does not work for me.
Modify the TDdeClientConv.ExecuteMacro function in ddeman.pas to the following.
{ Modified to set the user handle for the transaction. The DdeMsgCallBack }
{ function will not reset FWaitStat without this handle, effectively }
{ disabling your connection after the first macro execution. CIC 03/10/97 }
{ by Chad Crawley <snafo_AT_kcnet.com> }
function TDdeClientConv.ExecuteMacro(Cmd: PChar; waitFlg: Boolean): Boolean;
var
hszCmd: HDDEData;
hdata: HDDEData;
ddeRslt: LongInt;
bSetHandle: Boolean;
begin
Result := False;
if (FConv = 0) or FWaitStat then Exit;
hszCmd := DdeCreateDataHandle(ddeMgr.DdeInstId, Cmd, StrLen(Cmd) + 1,
0, 0, FDdeFmt, 0);
if hszCmd = 0 then Exit;
if waitFlg = True then FWaitStat := True;
hdata := DdeClientTransaction(Pointer(hszCmd), -1, FConv, 0, FDdeFmt,
XTYP_EXECUTE, TIMEOUT_ASYNC, @ddeRslt);
bSetHandle := DdeSetUserHandle(FConv, ddeRslt, DWord(Self));
if (hdata = 0) or (bSetHandle = False) then FWaitStat := False
else Result := True;
end;
Hope you find this useful.
Randy Shaw
|