

Do the following to provide DDE client support in your Windows or OS/2 application:
If you want to have multiple concurrent conversations, repeat the same procedure for each simultaneous conversation you need. Remember, although an IDDEClientConversation object represents a single conversation with a single server at any point in time, you can reuse the object for a subsequent conversation, after you have ended the current conversation.
You can begin a DDE conversation in the following ways:
The begin function requires you to specify the name of the application you wish to have a conversation with, and the name of the topic you are interested in having a conversation about. For example:
bool bStarted = aConversation.begin( "Weather Server","Today's Forecast")
The begin function returns true if the IDDEClientConversation object succeeds in initiating a conversation with the requested application on the requested topic. If the IDDEClientConversation object is already in conversation on any topic, it will throw an IInvalidRequest exception. You can reuse the IDDEClientConversation object for a subsequent conversation once you have ended the current conversation.
The IDDEClientConversation class provides a second version of the begin function. Use this if you have already established a DDE conversation with another application, and you have an alternate method of exchanging the requisite window handles.
To request data from a server application, use the requestData function. A server application can respond to a request for data in one of two ways:
In both cases, the following points are true:
The DDE protocol supports ongoing links to data items, called hot links. Once you establish a hot link with a DDE server application for a particular data item, the server informs you whenever the value of the data changes. To request a hot link to a data item with a server application, you must use the beginHotLink function.
After you have established a data hot link, every time the value of the data item changes in the DDE server application, the following occurs:
| Note: | You can also use notification hot links. Every time the value of the data item changes in the DDE server application, the server sends a notification that the value of the data item has changed. When the IDDEClientConversation object receives the notification, it creates an IDDEClientHotLinkEvent object. You can then request the data when and if you need it. |
Use IDDEClientConversation::endHotLink and IDDEClientConversation::endHotLinks to end hot links. To end a single hot link, call the endHotLink function, specifying the name of the data item and, optionally, the format of the data. For example, if you have multiple active hot links with a DDE server application on the Weather Corp data item, each in a different format, end one of the hot links as follows:
aConversation.endHotLink("Weather Corp", SZFMT_CPTEXT);
Use the endHotLinks function to end multiple hot links with one function call. There are two ways you can use this function:
The DDE protocol introduces the concept of poking data from a DDE client application to a DDE server application. Poking data is essentially requesting a DDE server application to set a specified data item to a value passed by the client application. The IDDEClientConversation::pokeData member function sends a data poke request to the conversing DDE server application.
The IDDEClientConversation object throws an IInvalidRequest
exception if it is not currently engaged in a conversation and
the server application can respond to this request with either a
positive or negative acknowledgment. In either case, the
IDDEClientConversation object creates an IDDEAcknowledgePokeEvent
object and passes a reference to this event by calling the
pokeAcknowledged function.
The DDE protocol allows DDE client applications to send commands and command strings to DDE server applications for remote execution. Typically, you use this to send macros and commands to word processing or spreadsheet applications that support a command language and support this aspect of the DDE protocol. You can use IDDEClientConversation::executeCommands to send commands to DDE server applications.
To end the current conversation, call the IDDEClientConversation::end. The IDDEClientConversation object first cleans up and then resets all of its object data to their original values when constructed.
For an example of how to set up a DDE client, refer to the \samples\ioc\dde\ddeclnt directory.
![]()
IDDE
IDDEAcknowledgeEvent
IDDEActiveServer
IDDEBeginEvent
IDDEDataEvent
IDDEEndEvent
IDDEEvent
IDDEExecuteEvent
IDDEPokeEvent
IDDERequestDataEvent
IDDETopicServer