beautypg.com

Dynamic data exchange – Xerox -05W User Manual

Page 305

background image

13-13

Dynamic Data Exchange

/* Treat Key macro request as a special case */

if (MenuID == IDM_MACROS)

lSetting = MAKELONG(-DataGroup,iValue);

else

lSetting = MAKELONG(DataGroup,MenuID);

ultoa(lSetting,buf,10);

aItem = GlobalAddAtom((LPSTR)buf);

if (!PostMessage(

hWndPartnerDDE,

WM_DDE_REQUEST,

hWndSlaveDDE,

MAKELONG(CF_TEXT,aItem)

)

)

{

GlobalDeleteAtom(atomItem);

return -1;

}

/* Wait for DDE_DATA message return with requested data */

Xfer.Parameter = TRUE;

WaitForParameter();

return Xfer.Data;

}

The WaitForParameter function is not documented but basically waits in a loop,
monitoring the windows messages until a WM_DDE_DATA message appears that
corresponds to the initial WM_DDE_REQUEST. This then enables the
RequestSetting procedure to return with the appropriate value, or will return -1 if the
request fails. (This would be caused as a result of the Client Slave process receiving a
negative ACKnowledgement from TeemTalk following receipt of the
WM_DDE_REQUEST message.)

The processing of the WM_DDE_DATA message is shown on the next page.

This manual is related to the following products: