|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Use DDE to retrieve values Hello to all. I would like to communicate with an application using DDE. I tried with Excel by entering a formula "= app | topic_ Name" and it works very well. I tried under Visual C + + express but I have not succeeded. Code: char * szApplication = "app"; char * szTopic = "TOPIC"; ATOM atomApplication = * szApplication == 0? NULL: GlobalAddAtom (szApplication); ATOM atomTopic = * szTopic == 0? NULL: GlobalAddAtom (szTopic); printf ( "Sending message ... \ n"); SendMessage (HWND_BROADCAST, WM_DDE_INITIATE, (WParam) NULL, MAKELONG (atomApplication, atomTopic)); printf ( "message sent \ n"); if (atomApplication! = NULL) GlobalDeleteAtom (atomApplication); if (atomTopic! = NULL) GlobalDeleteAtom (atomTopic); printf ( "Waiting for a message \ n"); MSG message; GetMessage (& message, NULL, 0, 0); printf ( "Message received \ n"); If someone sees an error in my program or an example (simple) to use DDE in C it would be nice. Thank you |
#2
| |||
| |||
Re: Use DDE to retrieve values This is normal you do not loop until the message! You call the getMessage but he spends it on something else! If the DDE link in Excel takes a few ms and more you will receive nothing So the basic solution is to make a timer, and looping over getMessage with a timeout value Something more sophisticated would be a thread Looking at the MSDN help on getMessage. Quote:
|
#3
| |||
| |||
Re: Use DDE to retrieve values Quote:
Quote:
|
#4
| |||
| |||
Re: Use DDE to retrieve values Hi this prehistoric DDE is better to use COM, you can create a link OLE Automation / COM Excel to read / write to an Excel file Otherwise I think it works better in the loop of messages from the application process messages DDE. What type of project? win32 console UI? |
![]() |
|
Tags: dde, retrieve value |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to assign and retrieve values from JTextField in java swing | Rao's | Software Development | 4 | 20-01-2012 11:56 AM |
W32 registry values are not getting matched by the default values | Angrzej | Networking & Security | 5 | 19-05-2011 12:23 PM |
Retrieve multiple values from java class | Ash maker | Software Development | 5 | 13-02-2010 12:05 AM |
What are the RGB values? | Renderman21 | Operating Systems | 3 | 21-11-2009 09:45 AM |
How to use enum values in VB | $tatic | Software Development | 1 | 10-08-2009 06:25 PM |