Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Windows Dynamic Data Exchange : Exchanging data in conversations : Event-driven exchanges : Multiple conversations with advise links
 
Multiple conversations with advise links
If a DDE frame owns more than one conversation with advise links, you can get the channel number of the conversation and the name of the data item to which a DDE-NOTIFY event applies from the DDE-ID and DDE-ITEM attributes of the frame. This is enough information to retrieve the value that triggered the event with the DDE GET statement. However, you might also need the application and topic names to fully identify the item from which you are retrieving data. This is necessary if the different conversations (different topics and/or applications) include links to data items with the same name. You can obtain the application and topic names related to the current DDE-NOTIFY event from the DDE-NAME and DDE-TOPIC attributes of the frame. For more information on DDE frame attributes, see Defining conversation endpoints: DDE frames.
However, you might find it simpler to manage event-driven exchanges by using a separate DDE frame for each advise link. In this case, you initiate an additional conversation for each advise link that you want to establish for the same application and topic, using a separate DDE frame for each conversation. You then set up each advise link using its own conversation ID. When a DDE-NOTIFY event occurs for a linked data item, you do not have to check for the source of the event, because each data item has its own frame trigger. The following code fragment shows the essential elements of this technique to link two data cells in the same Excel worksheet to two ABL variables (quote1 and quote2):
DEFINE VARIABLE link1  AS INTEGER   NO-UNDO.
DEFINE VARIABLE link2  AS INTEGER   NO-UNDO.
DEFINE VARIABLE quote1 AS CHARACTER NO-UNDO.
DEFINE VARIABLE quote2 AS CHARACTER NO-UNDO.

DEFINE FRAME Flink1.
DEFINE FRAME Flink2.

ON DDE-NOTIFY OF FRAME Flink1 DO:
  DDE GET link1 TARGET quote1 ITEM "R2C1".
  ...
END.

ON DDE-NOTIFY OF FRAME Flink2 DO:
  DDE GET link2 TARGET quote2 ITEM "R2C2".
  ...
END.

DDE INITIATE link1 FRAME Flink1:HANDLE APPLICATION "EXCEL" TOPIC "Sheet1".
DDE INITIATE link2 FRAME Flink2:HANDLE APPLICATION "EXCEL" TOPIC "Sheet1".

DDE ADVISE link1 START ITEM "R2C1".
DDE ADVISE link2 START ITEM "R2C2".