Try OpenEdge Now
skip to main content
Programming Interfaces
External Program Interfaces : Windows Dynamic Data Exchange : Opening DDE conversations : Initiating a conversation
 
Initiating a conversation
After defining the DDE frame, invoke the DDE INITIATE statement for the frame, server name, and an available server topic. Most server applications provide a System topic that is available at startup. The data items for this topic generally include application command strings and other information to support DDE interactions with the application. In ABL, you can use this System topic to make other topics available to the client using the DDE EXECUTE statement. After you have made these topics available, you can open additional conversations for them.
The DDE INITIATE statement retrieves a channel number that uniquely identifies the conversation. You use this channel number with other DDE statements to invoke all other exchanges in the conversation.
For example, the following code fragment opens a conversation with Microsoft Excel's System topic, returning the channel number to sys. It uses the sys conversation to invoke the Excel NEW command, creating an initial Excel worksheet (Sheet1). It then opens a conversation with the Sheet1 topic, returning the channel number to sheet, as shown:
DEFINE VARIABLE sys   AS INTEGER NO-UNDO.
DEFINE VARIABLE sheet AS INTEGER NO-UNDO.
...
DDE INITIATE sys FRAME FRAME MainFrame:HANDLE
  APPLICATION "Excel" TOPIC "System".
DDE EXECUTE  sys COMMAND "[new(1)]".
DDE INITIATE sheet FRAME FRAME MainFrame:HANDLE
  APPLICATION "Excel" TOPIC "Sheet1".
...