HOWTO: Set Up Asynchronous DDE Transactions
ID: Q109853
|
The information in this article applies to:
-
Microsoft Visual FoxPro for Windows, versions 3.0, 5.0, 6.0
-
Microsoft FoxPro for Windows, versions 2.5, 2.5a, 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 query words:
Keywords : kbinterop
Version :
Platform :
Issue type : kbhowto