The client posts a WM_DDE_ADVISE message to the server to set up a permanent data link. The advise message contains a shared-memory pointer containing a DDESTRUCT data structure with the item name, format information, and status information. The following sample code shows how to establish a link:
WinDdePostMsg(hwndServer, /* Handle of server */ hwndClient, /* Handle of client */ WM_DDE_ADVISE, /* Message */ pddeStruct, /* Shared-memory pointer */ DDEPM_RETRY); /* Retry */
When a link is established with the DDE_FNODATA status flag set, a notification, not the data itself, is posted to the client each time the data changes. In this case, the server does not render the new version of the item when the source data changes, but simply posts a WM_DDE_DATA message with 0 bytes of data and the DDE_FNODATA status flag set, as shown in the following code fragment:
/* Specify the data length and status flag, */ /* when allocating shared memory */ pDDEdata->cdData = 0; pDDEdata->fstatus = DDE_FNODATA; . . . /* Post the message */ WinDdePostMsg(hwndClient, /* Handle of client */ hwndServer, /* Handle of server */ WM_DDE_DATA, /* Message */ pddeStruct, /* Shared-memory pointer */ DDEPM_RETRY); /* Retry */