How to Perform DDE with DDEDATA.APPID: Q112047 2.50 2.50a 2.50b WINDOWS kbinterop kbprg The information in this article applies to:
SUMMARYFoxPro for Windows can be both a dynamic data exchange (DDE) server and a DDE client. FoxPro for Windows ships with DDEDATA.PJX and all the source code. Using this application, and two instances of FoxPro for Windows, one as the client and one as the server, it is easy to demonstrate the value of DDE, as shown below.
MORE INFORMATIONNOTE: This article assumes that your machine has sufficient memory to run two instances of FoxPro for Windows. 1. Start FoxPro for Windows and open DDEDATA.PJX from the 2. Build the application.
3. Run DDEDATA.APP. This application sets up this instance of FoxPro for 4. Start another instance of FoxPro for Windows.
5. In order to establish the DDE link, type the following in the instance 6. To request some information from the server, type:
7. To get the next record's data, type:
8. To change the current record, type:
9. To end the conversation, type:
The variable m.confirm contains a .T. if the DDE link was terminated
successfully.
Additional features can be added to DDEDATA.APP. In order to do this, you must modify DDEDATA.PRG and then rebuild the application. This application simply institutes a large DO CASE statement in order to respond to different DDE messages. For example, even though DDEDATA.APP enables the DDEExecute service, it doesn't do anything with it. However, if you added
as part of the DO CASE statement in the cbDataTopic, then when you typed
the instance of FoxPro running DDEDATA.APP would display a wait window with
the text "Hello".
NOTE: The variable m.confirm again reveals if the command succeeded or failed. The "&sData" line is simply using macro substitution. The contents of sData are interpreted by FoxPro as if they had been typed in the Command window. DDEDATA.APP can be modified to accept and respond to many more requests. It is simply a matter of changing the DO CASE statement to accommodate these new items.
REFERENCES"Developer's Guide," version 2.5, Chapter 12 "Language Reference," version 2.5, pages L3-371, L3-363, L3-366,L3-369, L3-382 Additional reference words: FoxWin 2.50 2.50a 2.50b DDEData KBCategory: kbinterop kbprg KBSubcategory: FxinteropDde
|
|
Last Reviewed: May 1, 1996 © 1999 Microsoft Corporation. All rights reserved. Terms of Use. |