Please enable JavaScript to view this site.

ESL Documentation

ESL DDE support consists of an ESL include file that contains constant definitions for possible ESL DDE events.  Whenever the ESL DDE DLL receives a DDE message, it notifies the ESL program by invoking the corresponding stimulus event (if the program contains one).

When default processing is enabled, and the ESL program contains an active response that matches the stimulus event, and the action statements for that response carry out the appropriate DDE protocol response, the DDE DLL will not perform any default processing.

If the ESL program does not carry out the correct response, the DDE DLL will perform some appropriate response to maintain the integrity of the conversation.  Usually, this is to send a negative acknowledgment.

When default processing is disabled, the ESL program must carry out the appropriate DDE protocol response (by calling a DDE DLL function or subroutine) for each DDE event that is processed.  By disabling default processing, you can enter blocks within responses to DDE events before responding appropriately to the DDE event.  An example of an ESL program that might disable default processing is one that provides a DDE interface to a database, where you must enter a block to respond to data being returned from the database.

You can enable or disable default processing in an ESL program by using the DDESetDefaultProcessing subroutine and check the status of default processing by using the DDEQueryDefaultProcessing function.

Each ESL DDE stimulus event corresponds to a DDE message, with the exception of the ESL DDE DDE_ERROR event, which is invoked when the DDE DLL detects an error.

There are two DDE events that correspond to a single DDE message:  DDE_ACK and DDE_NACK.  These events correspond to the WM_DDE_ACK message.  Normally, a DDE partner sends a WM_DDE_ACK message with a status bit that tells whether the acknowledgment is positive or negative.  The DDE DLL looks at this status bit and invokes the messages shown in the following table.

Acknowledgment

Event Invoked

Message

Positive

DDE_ACK

WM_DDE_ACK with DDE_FACK status bit set

Negative

DDE_NACK

WM_DDE_ACK with DDE_FACK status bit cleared

This eliminates the need to query the status flag to determine the outcome of every acknowledgment.

Some points to remember about default processing  follow:

Initially, default processing is enabled.

Enabling or disabling default processing applies to the client or server as a whole; it is not on a per conversation basis.

Be sure to call the routines that get information on the existing conversation (DDEGetItemName, DDEGetFormat, ...) before the block is entered.  Once the block is entered within a DDE event response, the functions will return errors.

In the following example, the topic for the conversation, Topic_SV, is a specific table in the database.  The item name is the value of the key column for the table.  Error processing is not included in this example.  Default processing is disabled in this example.

Example

response to stimulus DDE DDE_REQUEST

 #  Get ItemName and Format before entering block

 copy DDEGetItemName (ConvID_IV) to ItemName_SV

 copy DDEGetFormat (ConvID_IV) to Format_SV

#  and proceed if both are valid

. . .

#  Send SQL Statement to SQL, e.g. send "select * from " Topic_SV

" where name = " ItemName_SV "\n" to SQL

 

#  Now, you may enter a block to get requested

#  data from the database without triggering a

#  default response

 

begin guarded

response to line "ERROR:" from SQL

      #  Send a negative ACK with DDEAck()

      . . .

response to line "SQL>" from SQL

      leave block response to line from SQL

      #  Send data to client with

          DDEDataString()

        . . . end