DDE functions

DDE is a data exchange mechanism which allows programs to talk to each other.  This can be used for one-off data exchanges, or continual transfers, that occur when data has been updated.

DDE only works on a Windows client, so for Querix this is currently supported by LyciaDesktop.  Lycia supports data exchange with any application that supports DDE.

The DDE process follows these four stages:

1

Your 4GL application sends a DDE order to the Windows client (LyciaDesktop) using TCP/IP.

2

LyciaDesktop executes the DDE order and sends the data to the Windows application through the DDE.

3

The Windows application executes the command and sends the data (or an error code) to LyciaDesktop.

4

LyciaDesktop sends the result to your 4GL application, using TCP/IP.

There are several DDE functions that can be used for the control of data exchange.

DDEConnect

DDEConnect opens a connection to an application which supports DDE.  It takes two arguments which are the name of the program that you want to exchange data with, and the document name, which is the name of the file in which the data is held.

DDEConnect (progname, docname)

Both the program and file name are CHAR(128) data strings.   The return value will be true if the connection has been opened successfully or false if an error occurred.

A DDE connection is represented by a unique identifier, which comprises the program name and the document name.

DDEExecute

The DDEExecute function executes a command in the specified document, using the open program.

DDEExecute (progname, docname, command)

Both the program and file name are CHAR(128) data strings.   The return value will be true if the connection has been opened successfully or false if an error occurred.

The third argument is optional and is a command to be carried out within the file that has been opened.  This is a CHAR(2048) data string, the syntax of which is dependent on the program that is used to open the file.  The program must be able to recognize the command.

DDEFinish

This is the same as DDEClose.

CALL DDEFinish (progname, docname)

DDEFinish closes the connection channel to the program and document specified as arguments in the syntax of the call.

Both arguments are of the CHAR(128) datatype.  The returned value is true if the channel was successfully closed.

DDEFinishAll

DDEFinishAll is used to close all DDE connections, and the program that is being communicated with via DDE.

DDEFinishAll () RETURNING ret

DDEFininshAll takes no arguments, it will close all open channels and related programs.  It will return True if all channels are closed, or False if an error occurs.  Any error details can be viewed using DDEGeterror.

DDEGetError

The DDEGeterror function retrieves the last error recorded for the DDE channel.

DDEGeterror ()

The function takes no arguments, returning only the last recorded error.  If there are no recorded errors in the current session the return will be NULL.

DDEPeek

The DDEPeek function will get values from a specified place within a specific file, and store those values in a variable.

CALL DDEPeek (progname, docname, cells)

All three of the arguments are of the CHAR(128) datatype.  Progname is the name of the operating program and docname is the name of the document opened by the program. Cells is the description of the place from where the data is taken, such as cell names in a spreadsheet.

If successful, the function will return the values from the specified locations; if an error occurs the return will be NULL.  Any error details can be seen using the DDEGeterror function.

If more than one value is returned, they are each separated by a TAB character.  Any new line characters are returned as ASCII 13 characters.

DDEPoke

The DDEPoke function sends data to the open document, and places it in the specified part of the document.

CALL DDEPoke (progname, docname, cells, values)

All four of the arguments are of the CHAR(128) datatype.  Progname is the name of the operating program and docname is the name of the document opened by the program.  Cells is the description of the place where the data is to be placed, such as cell names in a spreadsheet. Values is the data to be inserted in the place defined by cells.

The function will return TRUE if the data is transferred successfully, or FALSE if an error occurs.  Any error details can be seen using the DDEGeterror function.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.