Click here to Skip to main content
13,248,112 members (37,222 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


9 bookmarked
Posted 10 Jun 2012

DDEApp, DDE Based Inter-process Communication (C#, C++)

, 10 Jun 2012
Rate this:
Please Sign up or sign in to vote.
DDEApp, DDE Based Inter-process Communication (C#, C++)

This article discusses an inter-process communication protocol dedicated for sharing data and perform remote function call between applications.


DDE Application (DDEApp) is a Dynamic Data Exchange (DDE) based inter-process communication protocol created to exchange data and perform functions call between applications.

Back in 2009, when I was still programming in Borland C++ Builder, I needed to find a solution to call function remotely between two applications. We had decided to make use of DDE for this purpose. Using VCL control in Borland, we managed to get DDE up within few days. However, soon we realized that the existing DDE protocol was not able to fully meet our requirement.

About DDEApp

DDEApp is a command line inter-process communication protocol implemented based on DDE. It contains a client and host class named as below.

 C#Borland C++
DDEApp ServerDDEAppServerMDDEApp_Server
DDEApp ClientDDEAppClientMDDEApp_Client

An overview of the classes is shown as below. DDEApp Client is designed to handle multiple clients.

Actual inter-process communication took place in DDE Server and Client class.

DDEApp Features

Hide Low Level Settings from User

There are several parameters that need to be set correctly in DDE Server and Client class before two processes can "talk" to each other using DDE. Client needs to know the server's setting upfront. User must figure out these settings either from code or documentation to establish DDE connection with Server.

DDEApp hides all DDE related parameters from user. Users who use DDEApp did not need any knowledge of DDE. A standard sets of setting will be used for all DDEApp Server and Client instances. This means that all DDEApp Servers and Clients can communicate with each others.

Support Multiple Clients and Servers

DDEApp Client and Server is designed to handle multiple clients and servers. A DDEApp Client can connect to multiple servers while a DDEApp Server is able to handle respond from multiple clients.

The diagram above shows that both Client A and C are connecting to more than 1 server while Server B have 3 clients connected to it. Besides, Server B also can be configured as Client to communicate with Server C at the same time being a server.

DDEApp Protocol

To ensure the correct message is passed between selected server and client, DDEApp implemented a command line message protocol which contains information of sender and receiver as below:

<Source> <Dest> <Commands>

  • Source: Sender application's EXE name
  • Dest: Receiver application's EXE name
  • Commands: DDEApp commands

When using DDEApp class, we do not need to remember the command format. Encode and decode of the commands are done internally by DDEApp Client and Server class.

A DDEApp Server is visible as virtual class to client application with list of registered functions and variables. Registered functions are accessible using FunctionCall() in DDEApp Client whereas registered variable are accessible from VariableRead() and VariableWrite() in DDEApp Client.

Cross platform (C++ / C#)

As an inter-process communication protocol, DDEApp allows application build from different platform (e.g. Borland Builder 5, Borland Builder 6, Visual C#) to communicate with each other. This is useful for mid to large scale projects when code conversion from one platform to another is time consuming and expensive.

Standard Functions

DDEApp Server included a list of common functions to remotely control the server's application.

  • Help
  • HideMainForm
  • RestoreWindow
  • MinimizeWindow
  • BringToFront
  • SetWindowPosition

Function Lists

The "Help" function shown above is an internal function created to return list of registered functions and variables from DDEApp Server. With these features, we are able to get the most updated functions and variables list which may change from version to version. This is much better than any external documentation.

The image below shows a list of functions and variables in DDEApp Client terminal returned from a DDEApp enabled server application.

Function Call with Error Reporting

All function calls from DDEApp Client to DDEApp Server are made via FunctionCall(). Client will receive execution status upon completion of the functions. FunctionCall() is available in both synchronous and asynchronous version.

The image below shows an example of DDEApp function call which returns without error. Besides, it also shows additional information sent from DDEApp Server when executing function.

This is another example that shows failed function call which returned an error message.

Variable Read / Write

Variable read or write are done in a similar way as function call except that variable are either read and write or just read only. Read or write to variable is a synchronous call using VariableRead() and VariableWrite().

Connect / Disconnect / Shut Down

DDEApp Client can be connected or disconnected from DDEApp Server when required using function Connect() and Disconnect(). Server will get notified when a client is connected or disconnected.

Besides, the client can request server to shut down using ShutDownServer() function. An OnClientShutdownQuery event will be raised at server application. Server has full authority to decide whether to proceed to shutdown itself.

Online / Offline

Online() and Offline() are two functions dedicated for DDEApp Server to enable or disable DDEApp protocol. When server is offline, none of the clients are allowed to connect to the server. Any client that was connected earlier will received a OnLinkClosed event.

DEMO and Tutorial


DDE Application and C++ Library is compiled using Borland C++ Builder.

If you were not able to run the executable file, please get the re-distributed library from below:

  • Borland C++ Builder 6 libraries. Download
  • Borland Developer Studio 2006 libraries. Download


This article, along with any associated source code and files, is licensed under The MIT License


About the Author

Code Artist
Technical Lead
Malaysia Malaysia
Official Page:

You may also be interested in...

Comments and Discussions

Questiondownload links don't work Pin
Member 768450613-Jul-15 1:16
memberMember 768450613-Jul-15 1:16 
AnswerRe: download links don't work Pin
Code Artist13-Jul-15 4:14
memberCode Artist13-Jul-15 4:14 
QuestionCan't access dropbox at work Pin
Sandeep Datta29-May-13 22:19
memberSandeep Datta29-May-13 22:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 10 Jun 2012
Article Copyright 2012 by Code Artist
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid