Progress
Language Reference


DDE EXECUTE Statement

Interfaces
OS
SpeedScript
All
Windows only
No

Instructs a dynamic data exchange (DDE) server application to execute one or more application commands.

SYNTAX

DDE EXECUTE ddeid COMMAND string
  [ TIME seconds ]
  [ NO-ERROR ] 

ddeid

An integer expression equal to the channel number of a conversation opened to execute the specified command string. It is the value returned by the DDE INITIATE statement that opened the conversation. You can usually execute commands using a conversation opened for the System topic of the server application.

COMMAND string

Specifies the command or commands for the server to execute, where string is a character expression containing commands that are defined by the server application (for example, the [select(...)] command in Microsoft Excel).

TIME seconds

Specifies the maximum number of seconds that the Progress client waits for the DDE EXECUTE statement to complete, where seconds is an integer expression. If you do not specify the TIME option or specify a value of 0, Progress waits indefinitely for the statement to complete.

NO-ERROR

By default, if the statement fails to execute the command(s), it sets the Progress error condition and posts the error to the DDE frame DDE-ERROR attribute. If you specify NO-ERROR, the statement does not set the Progress error condition but does post the error to the DDE frame.

EXAMPLE

The following fragment shows how to use the DDE EXECUTE statement. The procedure executes Microsoft Excel internally and opens a conversation for the Excel System topic. The System topic lets you execute Excel functions. This example uses the DDE EXECUTE statement to create a new Excel worksheet using the NEW function.

DEFINE VARIABLE Sys AS INTEGER.            /* DDE-ID to System topic */
DEFINE VARIABLE DDEframe AS WIDGET-HANDLE. /* DDE frame handle       */
CREATE FRAME DDEframe.                     /* Create DDE frame.      */

/* DLL routine to execute an MS-Windows application. */

PROCEDURE WinExec EXTERNAL "kernel32.dll":
  DEFINE INPUT PARAMETER ProgramName AS CHARACTER.
  DEFINE INPUT PARAMETER Presentation AS LONG.
END PROCEDURE. /* WinExec */
            .
            .
            .
/* Start Excel, open a DDE conversation with the Excel System topic, */
/* and create a worksheet.                                           */

RUN WinExec (INPUT "Excel /e", INPUT 2). /* 1=normal, 2=minimized */
DDE INITIATE Sys FRAME DDEframe APPLICATION "Excel" TOPIC "System".
DDE EXECUTE Sys COMMAND "[new(1)]".
            .
            .
            . 

NOTES

SEE ALSO

DDE INITIATE Statement


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095