The Dynamic Data Exchange method (DDE) allows other Windows programs to execute ZOC-commands remotely. While REXX Programs must run under control of ZOC, it is possible to let separate applications (e.g. ones written in C++) send requests to ZOC for processing.
In this introduction it is assumed that the reader knows about the basic concepts of DDE. The topics below deal only with implementation specific details.
A more detailed description and sample applications can be downloaded from ftp://ftp.emtec.com/zoc/
Sessions/Topics | |
ZOC will accept only one session at a time. The application identifier is ZOC and ZOC responds to the topics COMMUNICATION, COMM and COMM-DEBUG (the difference is, that the latter logs DDE events in the ZOC window to help debugging). ZOC does not respond to general DDE-requests (ones that do not specify app or topic). In addition to the application name ZOC, ZOC also responds
to ZOCn, where n is a number that reflects the number of
concurrently started ZOC instances. The first one is called ZOC1,
the next one reacts to ZOC2 etc.
| |
Sending Commands | |
You can send commands to ZOC either via DDE_EXECUTE (data field) or
DDE_REQUEST (item field). DDE_EXECUTE always responds with an DDE_ACK
message with a numeric return code in the AppRc field. DDE_REQUEST always
sends a DDE_DATA packet (even in case of error) with a result or with the
string ##ERROR## in the data field. The DDE_DATA packet must
not be acknowledged. Under Windows the data handle must be freed by
the receiver.
| |
Serialization | |
Commands must be strictly sent on a command-reply basis. ZOC does not
handle nested commands (e.g. sending another command while a ZocWait command
is pending).
| |
Command Format | |
DDE_EXECUTE and DDE_REQUEST accept the same form of commands, they only differ in the fact, that EXECUTE cannot be used to retrieve return values from functions. The commands must be zero terminated (C-style strings). ZOC does not handle commands enclosed in square brackets (as recommended in the Microsoft DDE specification) and it does not handle multiple commands per message. Unicode is not supported. A command can be sent in the form <command> <arguments> or <command>(<arguments>). The arguments can be separated by blank or comma. However, the recommended style is with brackets and comma. String should be placed between quotation marks but it is legal to send them without if they do not contain special characters. Here is a list of valid command strings. For backward
compatibility it is legal to omit the letters ZOC at the beginning of
the command words.
| |
List of Commands | |
Via DDE you can use the same set of commands/functions as in REXX. The
list can be found in the ZOC-Command Reference in the
appendix.
| |
Example | |
The following code is a small example of how to start a DDE connection
via Microsoft Access Visual Basic (VBA), to initialize the modem and check if it
returns "OK".
|
← Back to Programming ZOC (REXX/DDE)