Exchange data between Visual FoxPro and other Microsoft Windows-based applications.
Visual FoxPro can act as both a server and a client to send and receive data to and from other Microsoft Windows-based applications.
The following naming conventions are used in applications that support DDE (dynamic data exchange).
|
Name
|
Description
|
| Service Name | A name that the server responds to when a client tries to access the server. A server can support many service names. |
| Topic Name | A name that specifies a logical set of data. For file-based applications, topic names are usually file names. In other applications, topic names are application-specific. To access the server, the client must specify a topic name in addition to the server's service name. |
| Item Name | A name that specifies a unit of data that the server can pass to the client requesting the data. |
To request data from another application, create a Visual FoxPro program that establishes Visual FoxPro as a client. The following is a brief outline for creating a simple Visual FoxPro program that requests data from another application:
-
Establish a link to the server application with DDEInitiate( ).
-
If the link is successfully established, use DDERequest( ) to request data from the server application. DDERequest( ) can be issued repeatedly to request additional data.
-
After the data has been received, issue DDETerminate( ) to terminate the link to the server application to free up system resources.
The functions above establish a cold link. A cold link exists when the client initiates all the communications between the applications. For a discussion of other types of links, see DDEAdvise( ).
The following is a brief outline for a program that establishes Visual FoxPro as a server:
-
Use DDESetService( ) to create a service and specify the type of service.
-
Use DDESetTopic( ) to create a service topic and specify the procedure to execute when the topic is specified in a client request.
-
Create the procedure specified in DDESetTopic( ) to accept the parameters passed to the procedure.
-
Within the procedure, process the request and, if appropriate, return the requested data to the client.
Note that these DDE functions differ from previous Visual FoxPro function conventions in the following ways:
Reference
DDEAbortTrans( ) Function
DDEAdvise( ) Function
DDEEnabled( ) Function
DDEExecute( ) Function
DDEInitiate( ) Function
DDELastError( ) Function
DDEPoke( ) Function
DDERequest( ) Function
DDESetOption( ) Function
DDESetService( ) Function
DDESetTopic( ) Function
DDETerminate( ) Function
Other Resources
Functions
Language Reference (Visual FoxPro)