Lisp HUG Maillist Archive

DDE issues

Hi there,

I've been finding my way around DDE interface in LW having little luck.

It persistently refuses to request data from DDE servers I am running.

In order to do that one has to create a DDE conversation object which goes something like this:

(require "dde")

(setf conn (win32:dde-connect "MT4" "TIME"))

which basically means "establish a connection with a DDE server named "MT4"  with a topic called "TIME"" which seems to work fine, a conversation object is returned to that. Now if one tries to request some data via this conversation by means of 

(win32:dde-request conn string)  

where string is naturally the name of the item whose value we are trying to fetch here a fairly weird error is produced:

Error: DDE: Unable to establish conversation for service "MT4", topic :SYSTEM
1 (abort) Return to level 0.
2 Return to top loop level 0.

which looks like the environment is trying to establish a new conversation (for an unknown reason, since we have supplied one already), plus does it with a wrong topic, not the originally supplied "TIME" but :SYSTEM. The traceback looks even stranger than that (refer to the screenshot) because it is not at all obvious where the topic value gets replaced.

Yet I tried to mess around with DDE earlier on using an Excel server (I can't recheck it now since I don't have Excel at home, I'll try it again tomorrow) and did not have any similar issues and it worked by most part.

Does anyone have any experience with LW DDE module here on the list?



Fwd: DDE issues



---------- Forwarded message ----------
From: Yury Davidouski <yury.davidouski2@mail..dcu.ie>
Date: 9 March 2011 11:08
Subject: Re: DDE issues
To: Dmitriy Ivanov <divanov@ystok.ru>


I assume so since all the activity is happening in the top loop.

I managed to find a part of the solution with a supplement of win32:cf_text type to :format. It looks like:

(win32:dde-request conversation item :format win32:cf_text)

In this way I managed to get output from the three different DDE servers I was testing including Excel. However it turned out that the application I need to connect to has to be linked via an advise loop, otherwise it did not generate valid output.

From then other issues arose of establishing the mentioned advise loops from LW. No data could be obtained when an advise loop was established (if it was established altogether) and when the loop was terminated lots of output was generated similar to 

Warning: DDE: Unexpected XTYP_ADVDATA for #<DDE conversation (Client) Excel|C:/Documents and Settings/ydavidovsky/Desktop/[Book1.xls]Sheet1 0x2000580> "r1c1:r4c2" format 1

The example is for Excel but pretty much the same happens for the other servers.

The code for establishing the loop looks like this:

(dde-advise-start conn "r1c1:r4c2" :format 1 :datap t
                  :function (lambda (key item data &key &allow-other-keys)
                              (declare (ignore key))
                              (format t "Excel item ~a changed to ~a.~%"
                                      item data)))

I've been banging my head on this for a third day now, any input will be very appreciated. At the moment I have the app linked to Excel and do dde-requests from LW to get the values needed, it works, but I would be mentally more stable without this workaround.


On 9 March 2011 08:56, Dmitriy Ivanov <divanov@ystok.ru> wrote:
Yuri Davidovsky wrote on Mon, 07 Mar 2011 22:41:52 -0000 01:41:

| I've been finding my way around DDE interface in LW having little luck.
| It persistently refuses to request data from DDE servers I am running.
| In order to do that one has to create a DDE conversation object which
| goes something like this:
|...snip...|

Sounds like a multi-threading issue. Are you calling dde-request in the same
thread as dde-connect?

While talking to Acrobat/AcroReader, I usually invoke dde-execute-command
many times over the same connection without problem.
--
Sincerely,
Dmitriy Ivanov
lisp.ystok.ru



Updated at: 2020-12-10 08:38 UTC