WM_DDE_ADVISE

2.x

#include <dde.h>

WM_DDE_ADVISE
wParam = (WPARAM) hwnd;               /* handle of posting window   */
lParam = MAKELPARAM(hOptions, aItem); /* send options and data item */

A dynamic data exchange (DDE) client application posts the WM_DDE_ADVISE message to a DDE server application to request the server to supply an update for a data item whenever it changes.

Parameters

hwnd

Value of wParam. Identifies the sending window.

hOptions

Value of the low-order word of lParam. Specifies a handle of a global memory object that specifies how the data is to be sent.

aItem

Value of the high-order word of lParam. Specifies the data item being requested.

Return Value

This message does not return a value.

Comments

The global memory object identified by the hOptions parameter consists of a DDEADVISE data structure. The DDEADVISE data structure has the following form:

#include <dde.h>

typedef struct tagDDEADVISE {  /* ddeadv */
    WORD    reserved:14,
            fDeferUpd:1,
            fAckReq:1;
    short   cfFormat;
} DDEADVISE;

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

If an application supports more than one clipboard format for a single topic and item, it can post multiple WM_DDE_ADVISE messages for the topic and item, specifying a different clipboard format with each message.

Posting

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

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

The application allocates aItem by calling the GlobalAddAtom function.

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

Receiving

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 the WM_DDE_ACK message is positive, the application should delete the hOptions object; otherwise, the application should not delete the object.

See Also

DDEADVISE, GlobalAddAtom, GlobalAlloc, PostMessage, WM_DDE_DATA, WM_DDE_REQUEST