Xerox -05W Printer User Manual


 
13-14
Dynamic Data Exchange
/*************************************************************
FUNCTION: ClientReceivedData
PURPOSE: Called upon receipt of a WM_DDE_DATA
*************************************************************/
void
ClientReceivedData(HWND hWndDDE, HWND hWndPartnerDDE, LONG
IParam)
{
DDEDATA FAR * lpDDEData;
BOOL bRelease;
char szItemName(ITEM_NAME_MAX_SIZE+1);
/*If this Data is in response to a request for data */
/*clear awaiting flags etc accordingly */
if (GetConvPendingAck(hWndDDE) == REQUEST)
{
SetConvPendingAck(hWndDDE, NONE);
KillTimer(hWndDDE, hWndPartnerDDE);
}
if (!(lpDDEData = (DDEDATA FAR *)GlobalLock(LOWORD(lParam)))
| | (lpDDEData->cfFormat != CF_TEXT))
{ /* Negative ACK */
PostMessage(hWndPartnerDDE,
WM_DDE_ACK,
hWndDDE,
MAKELONG(0, HIWORD(IParam)))
);
}
GlobalGetAtomName(HIWORD(IParam), szItemName,
ITEM_NAME_MAX_SIZE);
Xfer.Data = *(int far *)(IpDDEData->Value);
Xfer.Parameter = FALSE; /* Clear flag for wait for
parameter to return */
if (IpDDEData->fAckReq)
PostMessage(hWndPartnerDDE,
WM_DDE_ACK,
hWndDDE,
MAKELONG(0x8000, HIWORD(IParam))
);
bRelease = IpDDEData->fRelease;
GlobalUnlock(LOWORD(IParam));
if (bRelease)
GlobalFree(LOWORD(IParam));
return;
}