DDE applications use WinDdePostMsg to communicate during data-exchange transactions. A client application posts transaction messages to a server, which responds by posting acknowledgment messages to the client. Transaction and acknowledgment messages have the same data structure. The first message parameter contains the handle of the sending window; the second contains a pointer to the shared-memory object that contains message information.
The DDE protocol defines five transaction types:
These transactions are permitted only within an exchange begun by using the WM_DDE_INITIATE message. Each transaction type has a corresponding message that a client uses to initiate the transaction with a server:
A server acknowledges a transaction message by posting a WM_DDE_ACK message to the client. The client must examine the status field of the DDESTRUCT data structure to determine whether the response is positive or negative.
A server application posts a WM_DDE_DATA message to the client to indicate that requested data is available. If the status bit of the DDESTRUCT structure has the DDE_FACKREQ flag set, the client must acknowledge receipt of the data by sending a WM_DDE_ACK message to the server.
The fifth parameter of WinDdePostMsg is a flag used to specify whether to try to post a message again if the first attempt failed because the destination queue was full (server returns the DDE_FBUSY flag). If the retry flag is set, WinDdePostMsg posts the message at 1-second intervals until the message is posted successfully.
The following sections explain the five basic types of DDE transactions and the messages involved with each. These messages are posted with WinDdePostMsg, which automatically builds and fills a DDEINIT data structure.