Microsoft KB Archive/107401: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - """ to """)
Line 13: Line 13:
== SUMMARY ==
== SUMMARY ==


The "Language Reference" manual and the Help file incorrectly state that the asynchronous user-defined function (UDF) option of the DDEExecute() command is passed five parameters. In fact, this option requires six parameters.
The "Language Reference" manual and the Help file incorrectly state that the asynchronous user-defined function (UDF) option of the DDEExecute() command is passed five parameters. In fact, this option requires six parameters.


== MORE INFORMATION ==
== MORE INFORMATION ==
Line 22: Line 22:
</pre>
</pre>
The third parameter of this command is an optional asynchronous UDF that permits asynchronous command execution requests. It returns either a transaction number or, if there is an error, it returns -1.
The third parameter of this command is an optional asynchronous UDF that permits asynchronous command execution requests. It returns either a transaction number or, if there is an error, it returns -1.
The &quot;Language Reference&quot; (page L3-364) and the Help file state that:
The "Language Reference" (page L3-364) and the Help file state that:


<pre>  If &lt;expC3&gt; is omitted, a client waits for the period specified
<pre>  If &lt;expC3&gt; is omitted, a client waits for the period specified
Line 33: Line 33:
   passed five parameters... .
   passed five parameters... .
</pre>
</pre>
NOTE: The syntax in the &quot;Language Reference&quot; and Help file incorrectly adds an additional &lt;expCn&gt;, which is why the text refers to &quot;&lt;expC3&gt;.&quot; The syntax shown in this article is correct; wherever &quot;&lt;expC3&gt;&quot; is mentioned in the manual and Help file, substitute &quot;&lt;expC2&gt;.&quot;
NOTE: The syntax in the "Language Reference" and Help file incorrectly adds an additional &lt;expCn&gt;, which is why the text refers to "&lt;expC3&gt;." The syntax shown in this article is correct; wherever "&lt;expC3&gt;" is mentioned in the manual and Help file, substitute "&lt;expC2&gt;."
However, the asynchronous UDF specified in the optional expression &lt;expC2&gt; is actually passed six parameters in this order:
However, the asynchronous UDF specified in the optional expression &lt;expC2&gt; is actually passed six parameters in this order:


Line 44: Line 44:
</pre>
</pre>
The following code example demonstrates the problem with passing five parameters to the asynchronous UDF. The code assumes that WINWORD.EXE and the file, GRAPHICS.DOC, are located in the directory C:\WORD20C.
The following code example demonstrates the problem with passing five parameters to the asynchronous UDF. The code assumes that WINWORD.EXE and the file, GRAPHICS.DOC, are located in the directory C:\WORD20C.
NOTE: The second parameter of the DDEExecute() function, '[FileOpen &quot;graphics.doc&quot;]', requires single quotation marks for the outer delimiter and double quotation marks for the inner delimiter.
NOTE: The second parameter of the DDEExecute() function, '[FileOpen "graphics.doc"]', requires single quotation marks for the outer delimiter and double quotation marks for the inner delimiter.


<pre>  RUN/N c:\word20c\WINWORD.EXE
<pre>  RUN/N c:\word20c\WINWORD.EXE
   channel=DDEInitiate('WinWord','System')
   channel=DDEInitiate('WinWord','System')
   IF channel&gt;=0
   IF channel&gt;=0
       =DDEExecute(channel,'[FileOpen &quot;c:\word20c\GRAPHICS.DOC&quot;]',;
       =DDEExecute(channel,'[FileOpen "c:\word20c\GRAPHICS.DOC"]',;
           'asyncUDF')
           'asyncUDF')
       WAIT WINDOW &quot;Calling asynchronous UDF&quot;
       WAIT WINDOW "Calling asynchronous UDF"
   ENDIF
   ENDIF
   =DDETerminate(channel)
   =DDETerminate(channel)
Line 61: Line 61:
   RETURN .T.
   RETURN .T.
</pre>
</pre>
An error message, &quot;Wrong number of parameters,&quot; will occur on the PARAMETERS statement in the asynchronous UDF. When the error occurs, choose the Cancel button in the error message box. To correct this error, add a sixth parameter to the PARAMETERS statement above. For example,
An error message, "Wrong number of parameters," will occur on the PARAMETERS statement in the asynchronous UDF. When the error occurs, choose the Cancel button in the error message box. To correct this error, add a sixth parameter to the PARAMETERS statement above. For example,
<pre>  PARAMETERS mChannel, mAction, mItem, mData, mFormat, mTransnum
<pre>  PARAMETERS mChannel, mAction, mItem, mData, mFormat, mTransnum
</pre>
</pre>

Revision as of 10:20, 20 July 2020

Asynchronous UDF on DDEExecute() Is Passed Six Parameters

ID: Q107401

2.50 2.50a 2.50b WINDOWS kbinterop kbdocerr

The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a, and 2.5b

SUMMARY

The "Language Reference" manual and the Help file incorrectly state that the asynchronous user-defined function (UDF) option of the DDEExecute() command is passed five parameters. In fact, this option requires six parameters.

MORE INFORMATION

The syntax of the DDEEXecute() command is:

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

The third parameter of this command is an optional asynchronous UDF that permits asynchronous command execution requests. It returns either a transaction number or, if there is an error, it returns -1. The "Language Reference" (page L3-364) and the Help file state that:

   If <expC3> is omitted, a client waits for the period specified
   with DDESetOption( ). If you specify the name of a UDF with
   <expC3>, client program execution continues immediately after
   the command execution request is made.

   When the server application finishes executing the command,
   the UDF specified with <expC3> is executed. The UDF is
   passed five parameters... .

NOTE: The syntax in the "Language Reference" and Help file incorrectly adds an additional <expCn>, which is why the text refers to "<expC3>." The syntax shown in this article is correct; wherever "<expC3>" is mentioned in the manual and Help file, substitute "<expC2>." However, the asynchronous UDF specified in the optional expression <expC2> is actually passed six parameters in this order:

     Channel Number
     Action
     Item
     Data
     Format
     Transaction Number

The following code example demonstrates the problem with passing five parameters to the asynchronous UDF. The code assumes that WINWORD.EXE and the file, GRAPHICS.DOC, are located in the directory C:\WORD20C. NOTE: The second parameter of the DDEExecute() function, '[FileOpen "graphics.doc"]', requires single quotation marks for the outer delimiter and double quotation marks for the inner delimiter.

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

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

An error message, "Wrong number of parameters," will occur on the PARAMETERS statement in the asynchronous UDF. When the error occurs, choose the Cancel button in the error message box. To correct this error, add a sixth parameter to the PARAMETERS statement above. For example,

   PARAMETERS mChannel, mAction, mItem, mData, mFormat, mTransnum

Additional reference words: FoxWin 2.50 2.50a 2.50b DDE DDEExecute asynchronous docerr errmsg err msg dynamic data exchange KBCategory: kbinterop kbdocerr KBSubcategory: FxinteropDde

Keywords          : kbcode kberrmsg FxinteropDde 
Version           : 2.50 2.50a 2.50b
Platform          : WINDOWS

Last Reviewed: May 22, 1998
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.