Solved

old DDE knowledge, anyone?

Posted on 2013-10-22
7
376 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 30

Accepted Solution

by:
Zoppo earned 500 total points
Comment Utility
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
Comment Utility
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 30

Expert Comment

by:Zoppo
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 11

Author Comment

by:ugeb
Comment Utility
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 30

Expert Comment

by:Zoppo
Comment Utility
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 30

Expert Comment

by:Zoppo
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now