Condividi tramite


DDE Functions

Exchange data between Visual FoxPro and other Microsoft Windows-based applications.

Remarks

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. Here 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:

  • The first four characters of these functions are not unique.
  • The function names exceed 10 characters and cannot be abbreviated.
    DDE Function Description
    DDEAbortTrans( ) Ends an asynchronous DDE transaction.
    DDEAdvise( ) Creates a notify link or an automatic link used in DDE.
    DDEEnabled( ) Enables or disables DDE processing or returns the status of DDE processing.
    DDEExecute( ) Using DDE, sends a command to another application.
    DDEInitiate( ) Establishes a DDE channel between Visual FoxPro and another Microsoft Windows-based application.
    DDELastError( ) Returns an error number for the last DDE function.
    DDEPoke( ) Sends data between client and server applications in a DDE conversation.
    DDERequest( ) Requests data from a server application in a dynamic DDE conversation.
    DDESetOption( ) Changes or returns DDE settings.
    DDESetService( ) Creates, releases, or modifies service names and settings in Visual FoxPro.
    DDESetTopic( ) In a DDE conversation, creates or releases a topic name from a service name.
    DDETerminate( ) Closes a DDE channel established with DDEInitiate( ).

See Also

DDEAbortTrans( ) | DDEAdvise( ) | DDEEnabled( ) | DDEExecute( ) | DDEInitiate( ) | DDELastError( ) | DDEPoke( ) | DDERequest( ) | DDESetOption( ) | DDESetService( ) | DDESetTopic( ) | DDETerminate( )