Solved

old DDE knowledge, anyone?

Posted on 2013-10-22
7
379 Views
Last Modified: 2013-12-04
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
0
Comment
Question by:ugeb
  • 4
  • 3
7 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 500 total points
ID: 39593432
Hi ugeb,

I think this is a good and detailed MS article about DDE: http://msdn.microsoft.com/en-us/library/windows/desktop/ms648775%28v=vs.85%29.aspx

At least it's not brief :o)

ZOPPO
0
 
LVL 11

Author Comment

by:ugeb
ID: 39594898
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?
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39596477
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
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 11

Author Comment

by:ugeb
ID: 39599558
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.
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39599971
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
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 39599981
PS: I guess even for Java and Python libraries are available to read into a XLS file ...
0
 
LVL 11

Author Closing Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question