Link to home
Start Free TrialLog in
Avatar of ugeb
ugebFlag for United States of America

asked on

old DDE knowledge, anyone?

Hi,

I know it's old technology, but I have an app that broadcasts Dynamic Data Exchange (DDE) messages that I need to receive. The app isn't old, but their data communication methodology is.  The problem is I don't know how to receive the messages and because DDE is old, resources are scarce as Google hasn't yielded much.

I've read the brief MS articles, but they're too terse to really gain much.

Can anyone point me to samples of C++ or Visual Basic code that acts as a DDE client? Maybe something I can compile without much change just to see how the communication happens?

Anyone?

Thanks!

p.s. I'm running on Windows 7
ASKER CERTIFIED SOLUTION
Avatar of Zoppo
Zoppo
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ugeb

ASKER

Thank you.  This is more detailed than what I had found by Googling.  Maybe it was hidden on the 15th page or so.

Do you know about this DDE stuff, or did you just find the link?
Well, I have a bit experience using DDE for opening files in my application i.e. from Explorer, but I didn't yet use it for other communication or data exchange.

But I guess it's pretty much the same, in fact when I double click a file in explorer my application get's send DDE message to retrieve the filename from passed data. Using this I implemented opening files this way even works while a modal dialog is active in my application. To do so I handle WM_DDE_EXECUTE messages to store the passend filename(s) in a list, in an overridden CWinApp::OnIdle (which is only called when no modal dialog is active) I check if the list contains entries and, if so, open the files.

BTW, maybe you could tell us a bit about what your goal is (i.e. you need to communicate with another foreign application which only supports DDE), your prerequisites (i.e. you want to write a new application so it doesn't matter which programming language and/or framework you choose) and what you tried so far?

ZOPPO
Avatar of ugeb

ASKER

Hi Zoppo,

Thank you for sharing that info with me.

Indeed, I am cornered into using DDE because another app I have uses it to broadcast data.  It's not even an old app, but they use DDE to broadcast values, primarily for Excel.

I do not want to have the overhead of having Excel open and calculating, or interpreting code and generally being slow when lots of values are coming in.  

I'd like to have a DDE client whereby I can collect the data from the app and process it with a more dedicated and optimized app. I'm probably indifferent to the language.  I know Python, Java and VBA decently, so VBA could be useful if I went down the VB route.  I used to know C++, but it's been over 5 years since I last used it.  My preference would be Python and then Java.

I looked at Java POI to read from Excel, but that has the disadvantages of 1) having Excel open, and 2) unreliable updating of cells when reading -- requiring saving of the file.  I've had problems with that.

I've also looked at PyWin32, but there is no documentation or working examples.

Based on a good recommendation someone else just gave me here, I tried an open sources 3rd party dot net DDE client/server library WinWedge:
http://www.taltech.com/support/entry/using_dde_in_dotnet

I managed to compile and run the app in Visual Basic .Net.  So, that's the route I'll pursue if I can't find anything better.
Hi ugeb,

sorry, unfortunately as told I didn't use DDE for such things before.

But, I'm even not sure if it is possible to write your own application to act as a DDE server replacement for Excel because IMO to do so you have to find out how Excel is identified, i.o.w. which atom is sent with WM_DDE_INITIALIZE, and acknowledge that message to tell the DDE client (the other app) your app is the appropriate DDE server.

This IMO will lead to problems since the behavior may differ depending on the fact Excel is running or not, hard to say.

Further (I'm not sure about this, maybe it's not important) if the other app even starts Excel it might get more difficult, depending on the method how Excel is started in this case you would need to somehow redirect it in a way it starts your app instead. In case registration in HKEY_CLASSES_ROOT is used IMO this won't be possible without messing up Excel's registration in a way i.e. double clicking onto a XLS file in Explorer would start your app instead of Excel.

As told, I'm not sure about this becuase I never tried, but I suspect it's at best difficult, maybe impossible, to find a convenient way to replace Excel as DDE server with your own app.

Is reading an XLS file in C a possible option for you? If say maybe you should take a look at libxls (http://libxls.sourceforge.net/) which is an open source library to read XLS files.

Beside this I have to admit I cannot help you much doing similar with Java, Python or VB. Anyway I think it shouldn't be too difficult to implement reading XLS files with VB.NET, if you plan to do so please tell, I'm quite sure samples can be found in the internet how to do it.

Best regards,

ZOPPO
PS: I guess even for Java and Python libraries are available to read into a XLS file ...
Avatar of ugeb

ASKER

Okay, thank you for all your thoughts on the subject.  I still have work to do, but I'm closer to getting it done!