windows_programming_notes.nbk: Home | Index | Next Page: WM_DDE_EXECUTE | Previous Page: WM_DDE_ADVISE


 WM_DDE_DATA

A 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.

To post this message, call the PostMessage function with the following parameters.

PostMessage( (HWND) hWnd, // handle to destination window WM_DDE_DATA, // message to send (WPARAM) wParam, // handle to server window (HWND) (LPARAM) lParam // data and item atom ); = Parameters =

Remarks

Posting The server application allocates the global memory object using the GlobalAlloc function. It allocates the atom using the GlobalAddAtom function.

The server must create or reuse the WM_DDE_DATA lParam parameter by calling the PackDDElParam function or the ReuseDDElParam function.

If the receiving (client) application responds with a negative WM_DDE_ACK message, the posting (server) application must delete the global memory object; otherwise, the client must delete the object after extracting its contents by calling the UnpackDDElParam function.

If the server application sets the fRelease member of the DDEDATA structure to FALSE, the server is responsible for deleting the object upon receiving either a positive or negative acknowledgement.

The server 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 impossible for the server to determine when to delete the object.

Receiving If fAckReq is TRUE, the client application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the client can either reuse the atom, or it can delete it and create a new one.

The client must create or reuse the WM_DDE_ACK lParam parameter by calling the PackDDElParam function or the ReuseDDElParam function.

If fAckReq is FALSE, the client application should delete the atom.

If the posting application specified global memory object as NULL, the receiving application can request the server to send the data by posting a WM_DDE_REQUEST message.

After processing a WM_DDE_DATA message in which the global memory object is not NULL, the client should free the object, unless one of the following conditions is true:

The fRelease member is FALSE. The fRelease member is TRUE, but the client application responds with a negative WM_DDE_ACK message. = Requirements = Windows NT/2000 or later: Requires Windows NT 3.1 or later. Windows 95/98/Me: Requires Windows 95 or later. Header: Declared in Dde.h; include Windows.h.


windows_programming_notes.nbk: Home | Index | Next Page: WM_DDE_EXECUTE | Previous Page: WM_DDE_ADVISE


Notebook exported on Monday, 7 July 2008, 18:56:50 PM Eastern Daylight Time