Perform Interprocess Communication
Using the DDE Management Library

Dynamic Data Exchange (DDE) 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 and updating of data. For example, using DDE your program can populate cells in an Excel spreadsheet or retrieve data from the spreadsheet.

This application is a demonstration of how to use the Dynamic Data Exchange Management Library (DDEML) through Visual Basic. The DDEML is a Win API programatic alternative to the standard form based DDE mechanisms provided by Visual Basic. The demonstration is written for synchronous communication however it can easily be changed for asynchronous. Check the Microsoft Platform SDK documentation for more information concerning DDEML programming.

Perform Interprocess Communication>Using the DDE Management Library
Download Source Code

Developed By

This application was developed by Eric D. Wilson. You can reach Eric at


DDE is a means for one application (the client) to communicate with another (the server) via messages. The client can send commands and data to the server which will run the commands and process the data. This exchange of messages is called a conversation.

Conversations are about a topic. Think of a topic as the fundamental data grouping used in an application. A workbook in Excel or a form in VB for instance. Topics can be about a specific item, say a particular Excel spreadsheet cell.

Lets look at an example of sending data to a cell in Excel. With this app and Excel running, the first step is to register this application with the DDEML. This is accomplished with a call to the DdeInitialize API when you click the Initialize button. Conversly, the DdeUninitialize function is used to free all DDEML resources when our conversation is complete.

Next we need to describe our conversation. The service or process that we will converse with is "Excel" and the topic is the "book1" workbook. For the item we can specify a cell such as "R1C1" and we can use a value of "test".

After these values are entered into the corresponding textboxes the Poke button can be pressed. This uses the DdeCreateStringHandle function to convert our conversation parameters into memory handles. A call to DdeConnect establishes a conversation with a server application that supports the specified service name and topic and returns a handle to the conversation.

Once a conversation is established, the DdeClientTransaction API transfers the actual data to the server (Excel) application. DdeClientTransaction call uses a Poke transaction type which means "send unsolicited data" to the server application.

The Execute and Request buttons perfom similar functions but use "Execute" and "Request" type transactions. Execute is used to send a command string to the server while Request asks the server for data.


The sample code contains two applications. A sample client and a sample of a server. To use the client, run it and follow the examples listed in the general declarations section of the main form.

To use the server, run both it and the client and follow the examples in the server application's main form's general declarations section.

About TheScarms
About TheScarms

Sample code
version info

If you use this code, please mention ""

Email this page

© Copyright 2024 TheScarms
Goto top of page