How to Create a DDE Server

3.5k views Asked by At

I have an application that works as DDE client & uses the data it receives to run few animations. This client is installed on Windows server 2012. I need to supply the DDE client application with few variables to run the animations properly.

On the same machine I don't have Microsoft Office installed so I can't use Excel for this job. Any idea how can I create a DDE server that service the required data to the client.

Searching in google has not resulted in clear tutorials on how to implement such this. I have very good programming skills in C/C++. However I need a guideline, recommended APIs, or clear tutorials.

Edit: I need the server & client applications to run on the same machine & same OS.

Thanks

1

There are 1 answers

1
Jerry Coffin On BEST ANSWER

DDE is defined almost entirely in terms of Windows messages, so to create a DDE server, you mostly:

  1. set up a connection in response to a WM_DDE_INITIATE
  2. listen for a WM_DDE_ADVISE or WM_DDE_REQUEST
  3. Respond with a WM_DDE_DATA as appropriate
    • immediately for a WM_DDE_REQUEST
    • as needed for a WM_DDE_ADVISE
  4. Shut down updates in response to a WM_DDE_UNADVISE
  5. Possibly also listen for WM_DDE_POKE messages to accept data from the client (if this makes sense in your case).
  6. Shut down a connection in response to WM_DDE_TERMINATE

Hmm...there's probably at least one other message that doesn't occur to me at the moment, but that probably covers at least 90% of cases (and at least in my experience, even WM_DDE_POKE is fairly unusual).

Since you (apparently) have a single, specific client in mind, you can probably trim that back somewhat. For example, it sounds like you probably don't need/want to support warm linking and such, so you probably don't care about WM_DDE_ADVISE/WM_DDE_UNADVISE. Your server can basically just initiate the connection when it receives WM_DDE_INITIATE, send data when it receives a WM_DDE_REQUEST, and shut down when it receives a WM_DDE_TERMINATE.