31.2.6 DDE Manager Library

Dynamic data exchange is a form of interprocess communication that uses shared memory to exchange data between applications. Applications can use DDE for one-time data transfers and for ongoing exchanges in which the applications send updates to one another as new data becomes available.

Dynamic data exchange differs from the clipboard data-transfer mechanism that is also part of the Windows operating system. One difference is that the clipboard is almost always used as a one-time response to a specific action by the user—such as choosing the Paste command from a menu. Although DDE may also be initiated by a user, it typically continues without the user's further involvement.

The DDEML provides a set of application programming interface (function) elements that simplifies the task of adding DDE capability to a Windows application. Instead of sending, posting, and processing DDE messages directly, an application uses the functions provided by the DDEML to manage DDE conversations. (A DDE conversation is the interaction between client and server applications.) The DDEML also provides a facility for managing the strings and data that are shared among DDE applications. Instead of using atoms and pointers to shared memory objects, DDE applications create and exchange string handles, which identify strings, and data handles, which identify global memory objects. DDEML provides service that makes it possible for a server application to register the service names that it supports. The names are broadcast to other applications in the system, which can then use the names to connect to the server. The DDEML also ensures compatibility among DDE applications by forcing them to implement the DDE protocol in a consistent manner.

Existing applications that use the message-based DDE protocol are fully compatible with those that use the DDEML. That is, an application that uses message-based DDE can establish conversations and perform transactions with applications that use the DDEML. Because of the many advantages of the DDEML, new applications should use it rather than the DDE messages.

The DDEML functions include:

Function Description

DdeAbandonTransaction Cancels an async transaction
DdeAccessData Converts a data handle to a pointer
DdeAddData Adds data to/reallocs, data handles
DdeCallback Application provided callback for DDEML.
DdeClientTransaction Starts a DDE transaction from the client side
DdeCmpStringHandles Compares two strings
DdeConnect Initiates a DDE conversation
DdeConnectList Initiates multiple DDE conversations
DdeCreateDataHandle Creates/initializes a data handle
DdeCreateStringHandle Atomizes a string
DdeDisconnect Terminates a conversation
DdeDisconnectList Terminates a list of conversations
DdeEnableCallback Turns on/off interruptible callbacks
DdeFreeDataHandle Releases interest in a data handle
DdeFreeStringHandle Frees an atom
DdeGetData Copies data from a data handle to a buffer
DdeGetLastError Retrieves last DDEML error
DdeInitialize Sets up DLL, delcares callback function address
DdeKeepStringHandle Increments atom use count
DdeNameService Registers/unregisters runtime DDE services
DdePostAdvise Updates server's links
DdeQueryConvInfo Extracts conversation/transaction information
DdeQueryNextServer Enumerates conversations in a list
DdeQueryString Retrieves string from string handle
DdeSetUserHandle Ties a 32 bit value to a conversation/transaction
DdeUnaccessData Releases pointer retrieved by DdeAccessData()
DdeUnitialize Shuts down DDEML instance
FreeDDElParam Frees a structure associated with lParam packing.
PackDDElParam Creates a structure for lParam packing
UnpackDDElParam Unpacks a structure for lParam packing.