How to Set Up Asynchronous DDE Transactions

Last reviewed: October 18, 1996
Article ID: Q109853
The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, versions 3.0, 5.0
  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SUMMARY

By default, a dynamic data exchange (DDE) conversation is processed synchronously. This means the application waits for a response from the other application before continuing execution.

Therefore, a synchronous transaction does not allow FoxPro for Windows program execution to continue until the server application has processed the DDE request, whereas an asynchronous transaction allows FoxPro for Windows program execution to continue without waiting for the server application.

For an example of how to set up an asynchronous transaction, see below.

MORE INFORMATION

The DDERequest(), DDEExcute(), and DDEPoke() commands support asynchronous transactions. These commands have additional parameters in the form of user- defined functions (UDFs) that are required for asynchronous transactions.

When a UDF is specified with the DDERequest(), DDEExcute(), or DDEPoke() functions, this UDF will be called when the server application is finished processing the DDE request.

The following code demonstrates how to use the DDEExecute() function asynchronously:

   RUN/N c:\winword\WINWORD.EXE
   channel=DDEInitiate('WinWord','System')
   IF channel>=0
      =DDEExecute(channel,'[FileOpen "c:\winword\GRAPHICS.DOC"]',;
           'asyncUDF')
      WAIT WINDOW "Calling asynchronous UDF"
   ENDIF
   =DDETerminate(channel)

   PROCEDURE asyncUDF    && asynchronous transaction UDF
   PARAMETERS mChannel, mAction, mItem, mData, mFormat, mTransnum
   DISPLAY MEMORY LIKE m*
   WAIT
   RETURN .T.

NOTE: The syntax for DDEExecute() is incorrect on page L3-363 of the FoxPro for Windows version 2.6 "Language Reference" manual and in the help
 file. The correct syntax is

  DDEExecute(<expN>, <expC1>[, <expC2>])

where <expC2> is the name of a UDF.


Additional reference words: 5.00 VFoxWin 3.00 FoxWin 2.50 2.50a 2.50b
docerr
KBCategory: kbinterop kbprg kbdocerr
KBSubcategory: FxinteropDde


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 18, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.