WM_DDE_DATA

This message, posted by a server application, sends a data item value to the receiving (client) application, or notifies the client of the availability of data.

Parameters

wParam

Contains the handle of the window posting the message.

lParam

Consists of hDdeData, a global handle to a DDEDATASTRUCT structure which describes the available data and what format it is in.

Comments

lParam contains a global memory handle which references a DDEDATASTRUCT data structure. It contains the following information:

Name Content

hData This is a handle that 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 by the client sending a WM_DDE_ADVISE message with the fDeferUpd bit set.
aItem An atom that identifies the data item for which data or notification is sent.

The global memory object identified by hData (of the DDEDATASTRUCT structure) consists of two words followed by the data being sent or received. The first word consists of one or more of the following flags:

Flag Meaning

0x8000 The application receiving the WM_DDE_DATA message should acknowledge receipt of the data by sending a WM_DDE_ACK message.
0x2000 The application receiving the WM_DDE_DATA message should free the memory identified by the low word of the lParam parameter.
0x1000 Indicates that the data was sent in response to a WM_DDE_REQUEST message. If this flag is not set, the data is sent in response to a WM_DDE_ADVISE message.

The second word specifies the format of the data. The format should be a standard or register clipboard format. The following standard clipboard formats may be used:

CF_TEXT
CF_BITMAP
CF_METAFILEPICT
CF_SYLK
CF_DIF
CF_TIFF
CF_OEMTEXT
CF_DIB
CF_PALETTE

Posting

Post the WM_DDE_DATA message by calling the PostMessage function, not SendMessage.

Allocate hDdeData and hData by calling the GlobalAlloc function with the GMEM_DDESHARE option.

Allocate aItem by calling the GlobalAddAtom function.

If the receiving (client) application responds with a negative WM_DDE_ACK message, the sending (server) application must delete the hDdeData and hData objects, otherwise the receiver (client) must delete the hDdeData and hData objects after extracting their contents.

If the sending (server) application sets the fRelease flag to zero, the sender is responsible for deleting both hDdeData and hData upon receipt of either a positive or negative acknowledgement.

Do not set both the fAckReq and fRelease flags to zero. If both flags are set to zero, it is difficult for the sending (server) application to determine when to delete hData.

Receiving

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

If fAckReq is zero, delete the aItem atom.

If the sending (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 the WM_DDE_DATA message, delete hDdeData and hData (if not NULL) unless either of the following conditions is true:

The fRelease flag is zero.

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

See Also

WM_DDE_POKE