Back in time with DDE

| 2 Comments

After completing some work for client with the custom CLR hosting server I've started looking into a problem for another client, it's a bit of a transition as the problem that he's having is with a DDE connection from his server to a SCADA system that monitors the industrial plant where the server is based.

DDE was the original way that Windows programs shared data between them. It's been around since 1987 and, well, that shows. The API is at once familiar (as an ancestor to COM) and quaint (which is a polite way of saying that I find some parts of it frustrating ;) ). For example, it's "interesting" to have to deal with an API which revolves around you providing a callback function pointer to it yet doesn't allow you to pass any 'user data' with that function pointer (so it's a (macro based) challenge to wrap DDE code in C++ classes and have multiple instances of them with correct callback function pointer associated to the correct class...).

Anyway, the problem that my client is having is that sometimes his server hangs whilst doing DDE stuff (mainly connecting to the remote application on another machine). The first thing I did was to put together a simple DDE server and, by making a few simple mistakes, my server was badly behaved enough to clearly demonostrate the hanging. What I found more interesting is that my badly behaved DDE server also managed to 'hang' various processes on my XP dev box; a newly spawned instance of explorer wouldn't appear until my badly behaved DDE server was killed... I've often felt that somewhere deep within windows there's a single threaded bottleneck that stalls the shell/explorer, perhaps it's to do with how DDE is used for shell file associations...

2 Comments

Aha, Raymon Chen has a piece on this over on The Old New Thing; see here http://blogs.msdn.com/oldnewthing/archive/2007/02/26/1763683.aspx.

And my badly behaved DDE server doesnt hang explorer on Vista...

Regarding the callbacks, I'd probably end up generating wrapper functions on the fly. But then I am a sadist ;).

Leave a comment