DDE applications communicate with each other by means of a DDE conversation. The DDE conversation is identified by a unique channel number that is assigned when the conversation is established. The channel number is then used as an argument to subsequent DDE functions. The following basic steps are commonly performed when using the DDE functions:
Open a DDE channel. DADiSP must first open a channel to the application it is exchanging data with. The DDEINITIATE function establishes the connection to the application and returns a channel number used by subsequent DDE functions.
Send or request data. Once a valid channel has been obtained, data can be exchanged. The DDEREQUEST function retrieves data as a string from another application and DDEGETDATA retrieves an entire series of data. DDEPOKE sends data as a string to an application. In addition, DDELINK and DDEADVISE automatically receive a series from an application whenever the data changes.
Close a DDE channel. After the DDE operations are completed, DDETERMINATE closes the channel between the applications.
For example, the steps outlined below demonstrate the basic command method of exchanging data between DADiSP and Excel.
chan = ddeinit("Excel", "Sheet1") // open a channel to Excel
aval = dderequest(chan, "R1C1") // get the current value of cell A1
ddepoke(chan, "R1C1", max(w1)) // send the max of W1 to cell A1
ddeterm(chan) // end DDE conversation