WM_DDE_DATA

2.x

#include <dde.h>

WM_DDE_DATA
wParam = (WPARAM) hwnd;             /* handle of posting window    */
lParam = MAKELPARAM(hData, aItem);  /* memory object and data item */

A dynamic data exchange (DDE) server application posts a WM_DDE_DATA message to a DDE client application to pass a data item to the client or to notify the client of the availability of a data item.

Parameters

hwnd

Value of wParam. Specifies the handle of the window posting the message.

hData

Value of the low-order word of lParam. Identifies the global memory object containing the data and additional information. The handle should be set to NULL if the server is notifying the client that the data item value has changed during a warm link. A warm link is established when the client sends a WM_DDE_ADVISE message with the fDeferUpd bit set.

aItem

Value of the high-order word of lParam. Specifies the data item for which data or notification is sent.

Return Value

This message does not return a value.

Comments

The global memory object identified by the hData parameter consists of a DDEDATA structure. The DDEDATA structure has the following form:

#include <dde.h>

typedef struct tagDDEDATA {   /* ddedat */
    WORD    unused:12,
            fResponse:1,
            fRelease:1,
            reserved:1,
            fAckReq:1;
    short   cfFormat;
    BYTE    Value[1];
} DDEDATA;

For a full description of this structure, see Chapter 3, “Structures.”

Posting

The application posts the WM_DDE_DATA message by calling the PostMessage function, not the SendMessage function.

The application allocates hData by calling the GlobalAlloc function with the GMEM_DDESHARE option.

The application allocates aItem by calling the GlobalAddAtom function.

If the receiving (client) application responds with a negative WM_DDE_ACK message, the posting (server) application must delete the hData object.

If the posting (server) application sets the fRelease member of the DDEDATA structure to FALSE, the posting application is responsible for deleting hData upon receipt of either a positive or negative acknowledgment.

The application should not set both the fAckReq and fRelease members of the DDEDATA structure to FALSE. If both members are set to FALSE, it is difficult for the posting (server) application to determine when to delete hData.

Receiving

If fAckReq is TRUE, the application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the application can reuse the aItem atom or delete it and create a new one.

If fAckReq is FALSE, the application deletes the aItem atom.

If the posting (server) application specified hData as NULL, the receiving (client) application can request the server to send the actual data by posting a WM_DDE_REQUEST message.

After processing a WM_DDE_DATA message in which hData is not NULL, the application should delete hData unless either of the following conditions is true:

The fRelease member is FALSE.

The fRelease member is TRUE, but the receiving (client) application responds with a negative WM_DDE_ACK message.

See Also

DDEDATA, GlobalAddAtom, GlobalAlloc, PostMessage, WM_DDE_ACK, WM_DDE_ADVISE, WM_DDE_POKE, WM_DDE_REQUEST