Link to home
Start Free TrialLog in
Avatar of Malek103197
Malek103197

asked on

DDE - getting started.

I'm trying to get started on writing some DEE apps but have not found much doc. on this topic in VC++. Can someone give me some sample code to get started, say to communicate with excel and pass some variables to and from excel from my app. I'm not sure how many points this would be worth as I do not know the complexity of such a task in VC++, so I'll start off low at 50.
Avatar of Malek103197
Malek103197

ASKER

Edited text of question.
ASKER CERTIFIED SOLUTION
Avatar of VCGuru
VCGuru

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
To communicate with Excel, DDE is not recommended. You should use Automation instead. Anyway, DDEML documentation is in the Platform SDK. See online version at

http://msdn.microsoft.com/library/sdkdoc/winbase/ddemlib_743d.htm

And there are a lot of technical articles about DDE in the MSDN Library. Go to MSDN Online Library (http://msdn.microsoft.com/library/), see the Technical Articles\Windows Platform\Base Services\DDE

You can also search Microsoft KB article for Excel AND DDE at http://search.microsoft.com/us/dev/.

If you want to do Automation, check out the Compiler COM Support samples that come with Visual C++. And

Automating Office with VC++: Knowledge Base Articles
http://www.microsoft.com/officedev/tips/autovc.htm

Office Automation with MFC
http://support.microsoft.com/support/officedev/mfckb.asp
Make a new class.It can base on MFC or not.
In the new class, you can proceeding DDE routine.
I have done this before.



For VCGuru:

Sorry for not getting back to you sooner. I've tried implementing the code you provided and have been reading up on the DDEML, however, I did not make it to first base. I placed the following function you provided in the InitInstance and got an "Unrecognized command", do I need to place a specific #include statement ?

Did not recognize this function:
DdeInitialize(&pidInst,NULL,APPCMD_CLIENTONLY,0);

thanks
For VCGuru,

Ignore that last comment, I discovered I needed to #include "Ddeml.h"
For VCGuru,

Thanks for the help. One thing I find difficult is translating the interactive commandsm, say in progman, to instructional commands from my VC++ code (eg. AddItem(C:/WINDOWS/CALC.EXE, Calculator)) how do i know to pass 2 variables and how would i know to pass the working directory and the Name?
For VCGuru,
A basic question. I have a dialog based app. called MyProg. I wish to pop up a MessageBox in a the InitInstance of MyProgApp. I've tried using the AfxMessageBox("Connction Failed"); but it does not get launched. Any ideas?

Thanks