Summary:
See also: Built-in Functions.
DDE is a form of inter-process communication implemented by Microsoft for Windows platforms. DDE uses shared memory to exchange data between applications. Applications can use DDE for one-time data transfers, and for ongoing exchanges in applications that send updates to one another as new data becomes available.
Please refer to your Microsoft documentation for DDE compatibility between existing versions. As an example, DDE commands were changed between Office 97 and Office 98.
With DDE Support, you can invoke a Windows application and send data to or receive data from it. To use this functionality, the program must use the Windows Front End.
Before using the DDE functions, the TCP communication channel between the application and the front end must be established with a display (OPEN WINDOW, MENU, DISPLAY TO).
The DDE API is used in a four-part procedure, as described in the following steps:
A DDE connection is uniquely identified by two values: The name of the DDE Application and the document. Most DDE functions require these two values to identify the DDE source or target.
The DDE API is based on the front call technique as described in Front End Functions. All DDE functions are grouped in the WINDDE front end function module.
Function name | Description |
DDEConnect | This function opens a DDE connection |
DDEExecute | This function executes a command in the specified program |
DDEFinish | This function closes a DDE connection |
DDEFinishAll | This function closes all DDE connections, as well as the DDE server program |
DDEError | This function returns DDE error information about the last DDE operation |
DDEPeek | This function retrieves data from the specified program and document using the DDE channel |
DDEPoke | This function sends data to the specified program and document using the DDE channel |
This function opens a DDE connection.
CALL ui.Interface.frontCall("WINDDE","DDEConnect",
[ program, document ], [result]
)
This function executes a DDE command.
CALL ui.Interface.frontCall("WINDDE","DDEExecute",
[ program, document, command
], [result] )
This function closes a DDE connection.
CALL ui.Interface.frontCall("WINDDE","DDEFinish",
[ program, document ], [result] )
This function closes all DDE connections as well as the DDE server program.
CALL ui.Interface.frontCall("WINDDE","DDEFinishAll",
[], [result] )
This function returns the error information about the last DDE operation.
CALL ui.Interface.frontCall("WINDDE","DDEError",
[], [errmsg] )
This function retrieves data from the specified program and document using the DDE channel.
CALL ui.Interface.frontCall("WINDDE","DDEPeek",
[ program, container, cells ],
[ result, value ] )
This function sends data to the specified program and document using the DDE channel.
CALL ui.Interface.frontCall("WINDDE","DDEPoke",
[ program, container, cells,
values ], [result] )
01
DATABASE formonly02
SCREEN03
{04
Value to be given to top-left corner :05
[f00 ]06
Value found on top-left corner :07
[f01 ]08
}09
ATTRIBUTES10
f00 = formonly.val;11
f01 = formonly.rval, NOENTRY;
01
MAIN02
-- Excel must be open with "File1.xls"03
CONSTANT file = "File1.xls"04
CONSTANT prog = "EXCEL"05
DEFINE val, rval STRING06
DEFINE res INTEGER07
OPEN WINDOW w1 AT 1,1 WITH FORM "dde_example.per"08
INPUT BY NAME val09
CALL ui.Interface.frontCall("WINDDE","DDEConnect", [prog,file], [res] )10
CALL checkError(res)11
CALL ui.Interface.frontCall("WINDDE","DDEPoke", [prog,file,"R1C1",val], [res] );12
CALL checkError(res)13
CALL ui.Interface.frontCall("WINDDE","DDEPeek", [prog,file,"R1C1"], [res,rval] );14
CALL checkError(res)15
DISPLAY BY NAME rval16
INPUT BY NAME val WITHOUT DEFAULTS17
CALL ui.Interface.frontCall("WINDDE","DDEExecute", [prog,file,"[save]"], [res] );18
CALL checkError(res)19
CALL ui.Interface.frontCall("WINDDE","DDEFinish", [prog,file], [res] );20
CALL checkError(res)21
CALL ui.Interface.frontCall("WINDDE","DDEFinishAll", [], [res] );22
CALL checkError(res)23
CLOSE WINDOW w124
END MAIN25
26
FUNCTION checkError(res)27
DEFINE res INTEGER28
DEFINE mess STRING29
IF res THEN RETURN END IF30
DISPLAY "DDE Error:"31
CALL ui.Interface.frontCall("WINDDE","DDEError",[],[mess]);32
DISPLAY mess33
CALL ui.Interface.frontCall("WINDDE","DDEFinishAll", [], [res] );34
DISPLAY "Exit with DDE Error."35
EXIT PROGRAM (-1)36
END FUNCTION
The following functions are provided for backward compatibility. We recommend that you use the front call functions if you write new code.
"\\t"
in a BDL string constant passed as parameter to the DDEPoke function. Function | Description |
DDEConnect( ) | This function opens a DDE connection |
DDEExecute( ) | This function executes a command in the specified program |
DDEFinish( ) | This function closes a DDE connection |
DDEFinishAll( ) | This function closes all DDE connections, as well as the DDE server program |
DDEGetError( ) | This function returns DDE error information about the last DDE operation |
DDEPeek( ) | This function retrieves data from the specified program and document using the DDE channel |
DDEPoke( ) | This function sends data to the specified program and document using the DDE channel |
This function opens a DDE connection.
CALL DDEConnect ( program STRING, document STRING )
RETURNING SMALLINT
This function executes a DDE command.
CALL DDEExecute ( program STRING, document STRING,
command STRING ) RETURNING SMALLINT
This function closes a DDE connection.
CALL DDEFinish ( program STRING, document STRING )
RETURNING SMALLINT
This function closes all DDE connections as well as the DDE server program.
CALL DDEFinishAll()
This function returns the error information about the last DDE operation.
CALL DDEGetError() RETURNING STRING
This function retrieves data from the specified program and document using the DDE channel.
CALL DDEPeek ( program STRING, container STRING,
cells STRING ) RETURNING value
This function sends data to the specified program and document using the DDE channel.
CALL DDEPoke ( program STRING, container STRING,
cells STRING, values STRING ) RETURNING SMALLINT