WM_DDE_ADVISE

This message, posted by a client application, requests the receiving (server) application to supply an update for a data item whenever it changes.

Parameters

wParam

Identifies the sending window.

lParam

Contains hDdeAdvise, a handle to a global DDEADVISESTRUCT object which identifies the requested data and specifies how the data is to be sent.

Comments

lParam points to a global memory object which is a DDEADVISESTRUCT data structure. It contains the following information:

Name Content

hOptions This is a global memory object which consists of a DDEADVISE data structure. This information specifies how the data is to be sent.
aItem This is an atom that specifies the data item being requested.

The global memory object identified by the hOptions field of the DDEADVISESTRUCT consists of a DDEADVISE data structure that contains the following:

Word Name Content

1 fAckReq If bit 15 is 1, the receiving (server) application is requested to send its WM_DDE_DATA messages with the ACK-requested bit (fAckReq) set. This offers a flow-control technique whereby the client application can avoid overload from incoming DATA messages.
  fDeferUpd If bit 14 is 1, the server is requested to send its WM_DDE_DATA messages with a null hData handle. These messages are alarms telling the client that the source data has changed. Upon receiving one of these alarms, the client can choose to call for the latest version of the data by issuing a WM_DDE_REQUEST message, or it can choose to ignore the alarm altogether. This would typically be used when there is a substantial resource cost associated with rendering and/or assimilating the data.
  reserved Bits 13–0 are reserved.
2 cfFormat The client's preferred type of data. Must be a standard or registered clipboard data format number.

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

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

Allocate hDdeAdvise by calling the GlobalAlloc function with the GMEM_DDE_SHARE option. The application receiving this message should free the hDdeAdvise structure after extracting its contents.

Allocate hOptions by calling the GlobalAlloc function with the GMEM_DDE_SHARE option.

Allocate aItem by calling the GlobalAddAtom function.

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

Receiving

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 the WM_DDE_ACK message is positive, delete the hDdeAdvise and the hOptions object; otherwise, do not delete the objects.