I have been fighting the whole evening with an attempt to get a DDE hotlink to Excel. It's normally done by invoking DdeClientTransaction like this (ToutEnMasm (http://www.masmforum.com/board/index.php?topic=7895.msg58045#msg58045)):
invoke DdeClientTransaction,NULL,NULL,tr.Hconv,tr.HRubrique,\
CF_TEXT,XTYP_ADVSTART + XTYPF_NODATA,TIMEOUT_ASYNC,addr tr.pdwResult
My code looks like this, and it fails (and so do other combinations of flags tried):
push eax ; ddx.hTemp = "R1:C1"
invoke DdeClientTransaction, 0, 0, ddx.hSheet, ddx.hTemp, CF_TEXT, XTYP_ADVSTART, TIMEOUT_ASYNC, esp
pop edx
Everything else works fine, I can read and write data from and to Excel. Unfortunately the code of ToutEnMasm has been deleted in the course of the forum transition :(
On the other, the whole World Wide Web does not offer a single page saying "Hey, I managed to get a hot link to Excel working", so at this point I wonder if Excel offers this feature at all...
on the old archive (#2)...
http://www.masmforum.com/archive2012/9454_DDE.zip (http://www.masmforum.com/archive2012/9454_DDE.zip)
see if that's what you want
it looks right - most of the comments are in French :P
Quote from: dedndave on March 31, 2013, 11:28:20 AM
see if that's what you want
it looks right - most of the comments are in French :P
Nice toy, although Yves is known for "fatal error A1000: cannot open file : \masm32\include\perso32.inc" messages ;-)
Will try today to put my stuff into a GUI. Somebody wrote that Win32 console cannot handle all DDE messages, although that is not documented anywhere. Which is the main problem: This stuff is old and badly documented. But for using Excel as a source of data it is still the best technique...
> Why don't use Office Document Model ? Excel fully supports COM and there are
> some examples in VB and VC in MSDN and also on MS site.
Roger Abbot: (http://computer-programming-forum.com/82-mfc/91dbf95c6d891f07.htm)
Because DDE programming is very simple compared to COM programming. It
is possible to do the job with a few lines of code and no dependency on
external dlls or the registry. COM versioning with updated components
can be an absolute PITA, DDE does not suffer from that. The essence of
DDE is to connect to an already running program, whereas COM is most
convenient when the client is creating objects and in sole control of
them. Often, you cannot guarantee which instance of a running
application COM will connect you to. With DDE you connect to a specific
spreadsheet, whichever instance owns it.
well, by looking at dates, it appears that ~4200 would be about right
i found one named 4194_dynamiq.zip, but i don't think that's the one you want
Thanks, Dave.
9454 is actually the right one, but 1. it suffers from various idiosyncratic error messages (perso32 not found... and if you provide that file, new errors pop up), and 2. it doesn't solve the problem. Yves uses the plain DDE with WM_ messages, not DDEML, and he doesn't deal with hotlinks to Excel.
Besides, my own further testing shows that even from a GUI app Excel simply refuses to launch an advise loop (DMLERR_NOTPROCESSED - with wrong paras, DdeGetLastError returns DMLERR_INVALIDPARAMETER).
So unless a miraculous solution pops up, the interface will not have hotlinks. As already mentioned, the World Wide Web does not reveal any evidence that real hotlinks can be established with Excel. Probably M$ just "forgot" to document this "feature" 8)
This page implies it's possible, though converting to usable code may be a different matter :badgrin:
http://v8doc.sas.com/sashtml/os2/z1ples.htm (http://v8doc.sas.com/sashtml/os2/z1ples.htm)
It looks like you have to explicitly state that you want a hotlink for it to work.
i googled Excel DDE and came up with many hits
perhaps they are blocked in Italia :P
the first one looks particularly informative...
http://office.microsoft.com/en-us/excel-help/create-a-link-using-dynamic-data-exchange-dde-HP003066210.aspx (http://office.microsoft.com/en-us/excel-help/create-a-link-using-dynamic-data-exchange-dde-HP003066210.aspx)
http://support.microsoft.com/kb/279721 (http://support.microsoft.com/kb/279721)
http://www.interactivebrokers.com/php/apiUsersGuide/apiguide/excel/dde_for_excel.htm (http://www.interactivebrokers.com/php/apiUsersGuide/apiguide/excel/dde_for_excel.htm)
http://www.codematic.net/excel-development/excel-dev-general/excel-dde-links.htm (http://www.codematic.net/excel-development/excel-dev-general/excel-dde-links.htm)
Quote from: dedndave on April 01, 2013, 02:40:42 AM
perhaps they are blocked in Italia :P
They are not blocked, but they all deal with Excel in the role as hotlink client, not server...
Quote from: Tedd on March 31, 2013, 11:21:38 PMIt looks like you have to explicitly state that you want a hotlink for it to work.
Yes, that's what XTYP_ADVSTART is supposed to do: Ask the server to send a message if cells are changing. But the server (Excel) responds "Sorry, I won't process your demand". If you post bad paras, it responds with a different message. Meaning that he understands the request but refuses to process it.
Re SAS, I saw them, too, and wonder how they do it.
There is a workaround - polling - but it doesn't sound the right solution for a bigger spreadsheet.
Another workaround would be polling only for the size of a given range, certainly faster but you would miss changes that do not alter the size.
i don't know much about using DDE (specifically, DDEML), but i am willing to have a go at it - lol
in reading, i see things like DdeInitialize and DdeCallback mentioned, but i do not see them mentioned in your posts
am i to assume you have all that going ?
doing some reading.....
if you want to find old information, you have to go old - lol
looking around for things that were in vogue for windows 3.1, 95, 98
and older versions of office - i still use office 97 pro (under xp) - so i have some info on that
i have the Excel 97 SDK, which doesn't provide much help on DDE,
but it does offer some examples on creating XLL files, which you could possibly make use of
http://download.microsoft.com/download/excel97win/Install/1.0/W9XNT4XP/EN-US/excel97sdk.exe (http://download.microsoft.com/download/excel97win/Install/1.0/W9XNT4XP/EN-US/excel97sdk.exe)
http://download.microsoft.com/download/platformsdk/sample27/1/NT4/EN-US/Frmwrk32.exe (http://download.microsoft.com/download/platformsdk/sample27/1/NT4/EN-US/Frmwrk32.exe)
(i used 7-zip to extract files on both)
i suspect you could find more DDE info for "excel for windows 3.1" - perhaps the SDK
i also found these articles that may be helpful
http://msdn.microsoft.com/en-us/library/ms997518.aspx (http://msdn.microsoft.com/en-us/library/ms997518.aspx)
http://msdn.microsoft.com/en-us/library/ms997524.aspx (http://msdn.microsoft.com/en-us/library/ms997524.aspx)
on the 5th and 6th lines down, you will see a couple "Click here" downloads
the first one is for a server app - not what you want
but, the second one is for a client app, named DdeRecon.exe
it must be a self-extracting zip - i used 7-zip to extract files, as i always do
something that may provide further help is to google around for "DdeRecon"
you will see where other developers have used that demo as an example
i.e., they were following the same path as you
This one don't use perso32.inc (I have just replace copier by lstrcpy)
Hope he can be compiled without problem/
Merci, Yves - ça marche avec des petites corrections:
- rename serveur.rc as asmserveur.rc
- rename client.rc as asmclient.rc
- change in asmclient.rc: #include <C:\MASM32\INCLUDE\RESOURCE.H>
However, it does not really solve my problem with the XTYP_ADVSTART call to Excel...
@Dave: have checked DdeRecon - see attachment. The original exe fails miserably with Excel 2003 on XP.
it seems to work with Excel 97...
(http://img833.imageshack.us/img833/2210/excelddeclient.png)
i am guessing the "|" chars are nulls
Dave,
Where did you find that historic version of Excel? :dazzled:
In the meantime I posted A Number Cruncher's Easter Egg (http://masm32.com/board/index.php?topic=1733.0), to show off a little bit :biggrin:
Happy Easter to you, ToutEnMasm and Tedd (for good advice), and everybody else here :t
Quote from: jj2007 on April 01, 2013, 10:58:51 AM
Where did you find that historic version of Excel? :dazzled:
lol - back, about 1999, i needed Excel to be compatible with a business client
so - i got office 97 pro - not cheap, either
i really grew fond of PhotoEditor that came with it for a few functions (adjusting color, cropping)
in newer versions of office, they stopped including it
anyways, until i have to upgrade, i will use this one :P
with the file converters and other updates, i can open most Excel documents
and, i sometimes use Word for writing
the point is - DdeRecon does work - you have to use the right syntax for "item" :P
Quote from: jj2007 on April 01, 2013, 10:58:51 AM
Happy Easter to you, ToutEnMasm and Tedd (for good advice), and everybody else here :t
Happy Easter, Jochen - and to all
Quote from: dedndave on April 01, 2013, 11:11:28 AM
the point is - DdeRecon does work - you have to use the right syntax for "item" :P
Bloody hell, it does - and it's a 16-bit executable, so I can't debug it :(
have you forgotten SymDeb and Debug ? - lol
even though it is 16-bit and C, it does tell you what functions to call and which flags to use
i would think it would be a big help
i mean - at least it isn't written in C++ or C# or something - lol
Quote from: dedndave on April 01, 2013, 02:35:55 PM
i mean - at least it isn't written in C++ or C# or something - lol
It's plain C, and I tried to rebuild it with PellesC but no luck - the usual bunch of cryptic error messages :(
Quote from: jj2007 on April 01, 2013, 06:23:02 PM
It's plain C, and I tried to rebuild it with PellesC but no luck - the usual bunch of cryptic error messages :(
Had no problem to build it with VC 2003 Toolkit ( exceot a tiny change: _fstrupr() -> _strupr() )
i had no luck with my older Excel, Andreas
but - nice going - it may work with a newer version of Excel
at any rate, i was suggesting you use the source as a guideline to write an asm version
if i had more time to play with it, i would give it a whirl
but, no, i get to do sister's drywall today - lol
Hi,
DdeRecon seems to work with Excel 2000. I can post a screen
shot if wanted.
Steve
great - that should be good enough to get Jochen going :t
Quote from: japheth on April 01, 2013, 08:57:32 PM
Quote from: jj2007 on April 01, 2013, 06:23:02 PM
It's plain C, and I tried to rebuild it with PellesC but no luck - the usual bunch of cryptic error messages :(
Had no problem to build it with VC 2003 Toolkit ( exceot a tiny change: _fstrupr() -> _strupr() )
Thanks, Andreas. With Excel 2003, it finds the servers (Excel, Folders, PROGMAN, Shell) but no service topics.
Quote from: dedndave on April 01, 2013, 11:30:39 PM
great - that should be good enough to get Jochen going :t
I am going, actually - now the hotlink works like a charm :biggrin:
More tomorrow evening.
OK - here it is...
Assembly requires latest 3 April MB version (http://www.masm32.com/board/index.php?topic=94.0).
The attached XlsViewer.exe can send strings to selected cells, and updates via hotlink changes that the user does in Excel to the cells that were selected at the moment of clicking "Hotlink".
Grateful if somebody could test it on Window 8...
Thanks,
jj
Hi Jochen,
Quote from: jj2007 on April 03, 2013, 09:54:19 AM
Grateful if somebody could test it on Window 8...
Thanks,
jj
I've a new laptop with Windows 8 installed, but no MS Office. Will Libre Office do the same job?
Gunther
Quote from: Gunther on April 03, 2013, 10:41:24 AMWill Libre Office do the same job?
Scheint so. (https://help.libreoffice.org/Common/General_Glossary/de#DDE) Einfach mal ausprobieren ;-)
Now the question is whether they also use "Excel" as server name :badgrin:
Found it: They call the server Soffice (https://help.libreoffice.org/Calc/Spreadsheet_Functions#DDE)... so good ol' DDE exists there, too, but now the big question is if, apart from a different server name which is easy to adjust, there are other little discrepancies :(
Hey jj, seems to work - win8 pro x64, office 2010 x64
Quote from: sinsi on April 03, 2013, 07:20:06 PM
Hey jj, seems to work - win8 pro x64, office 2010 x64
Thanks, John. Given that they deprecated DDE almost twenty years ago, that's encouraging :biggrin:
Jochen,
Quote from: jj2007 on April 03, 2013, 04:16:46 PM
Scheint so. (https://help.libreoffice.org/Common/General_Glossary/de#DDE) Einfach mal ausprobieren ;-)
I'll try it tomorrow.
Gunther