DDEInitiate( ) Function Example

The following example uses DDEInitiate( ) to establish a DDE channel between Visual FoxPro and a Microsoft Excel worksheet named Sheet1. 'Excel' is the service name, and 'Sheet1' is the topic name. The channel number is stored to the memory variable mchannum for use in subsequent DDE functions.

mchannum = DDEInitiate('Excel', 'Sheet1')
IF mchannum != -1
   * Process client actions
   = DDETerminate(mchannum)  && Close the channel
ENDIF