[python-win32] dde trouble

Patrick Janssen patrick at janssen.name
Fri Jun 19 15:33:02 CEST 2009


Hi Thomas,
Thanks for your email. Yes - I tried that  - actually, I used Spy++, which
seems to be the new version. This gave some useful information, but not the
actual command string.

I have pasted below the results for three different operations in Lua and in
Python - the third one is the one that is not working.

======================================================
1) When the Lua script manager connects to Ecotect, I see this DDE message:

<00001> 0039054A S WM_DDE_INITIATE hwnd:002404F2 aApp:C07F ("Ecotect")
aTopic:C0A2 ("request") [wParam:002404F2 lParam:C0A2C07F]
<00002> 0039054A R WM_DDE_INITIATE lResult:00000000
... repeated lots of times
<00241> 002404F2 S WM_DDE_ACK hwnd:000E0508 aApp:C07F ("Ecotect")
aTopic:C0A2 ("request") [wParam:000E0508 lParam:C0A2C07F]
<00242> 002404F2 R WM_DDE_ACK lResult:00000000
<00243> 001404BE R WM_DDE_INITIATE lResult:00000000

In Python I do this (which works fine):

import win32ui
import dde
server = dde.CreateServer()
server.Create("TestClient")
conversation = dde.CreateConversation(server)
conversation.ConnectTo("Ecotect", "request")

And I get the almost the same DDE message:

<00001> 001805CC S WM_DDE_INITIATE hwnd:00110750 aApp:C07F ("Ecotect")
aTopic:C0A1 ("request") [wParam:00110750 lParam:C0A1C07F]
<00002> 001805CC R WM_DDE_INITIATE lResult:00000000
... repeated lots of times
<00281> 00110750 S WM_DDE_ACK hwnd:000E0508 aApp:C07F ("Ecotect")
aTopic:C0A1 ("request") [wParam:000E0508 lParam:C0A1C07F]
<00282> 00110750 R WM_DDE_ACK lResult:00000000
<00283> 001404BE R WM_DDE_INITIATE lResult:00000000

======================================================
2) When Lua sends the command cmd("new.model"), I see the DDE message:

<00304> 002C0474 P WM_DDE_EXECUTE hwnd:00230542 lPackedVal:01A304EC
hCommands:01A304EC [wParam:00230542 lParam:01A304EC]
<00305> 00230542 P WM_DDE_ACK hwnd:002C0474 lPackedVal:001C3668 wStatus:0000
aItem:3668 ("#13928") [wParam:002C0474 lParam:001C3668]
<00306> 002C0474 P WM_DDE_EXECUTE hwnd:00230542 lPackedVal:01A304EC
hCommands:01A304EC [wParam:00230542 lParam:01A304EC]
<00307> 00230542 P WM_DDE_ACK hwnd:002C0474 lPackedVal:002000B0 wStatus:0000
aItem:00B0 ("#176") [wParam:002C0474 lParam:002000B0]

In Python I do this (which also works fine):

conversation.Exec("model.new")

And I get the almost the same DDE message:

<00232> 00340408 P WM_DDE_EXECUTE hwnd:001C0494 lPackedVal:01A304EC
hCommands:01A304EC [wParam:001C0494 lParam:01A304EC]
<00233> 001C0494 P WM_DDE_ACK hwnd:00340408 lPackedVal:00239698 wStatus:0000
aItem:9698 ("#38552") [wParam:00340408 lParam:00239698]

======================================================
3) When Lua sends the command get("app.computer"), I see the DDE message:

<00312> 002E0474 P WM_DDE_EXECUTE hwnd:002B042E lPackedVal:01A304EC
hCommands:01A304EC [wParam:002B042E lParam:01A304EC]
<00313> 002B042E P WM_DDE_ACK hwnd:002E0474 lPackedVal:001A8B60 wStatus:0000
aItem:8B60 ("#35680") [wParam:002E0474 lParam:001A8B60]
<00314> 002E0474 P WM_DDE_EXECUTE hwnd:002B042E lPackedVal:01A304EC
hCommands:01A304EC [wParam:002B042E lParam:01A304EC]
<00315> 002B042E P WM_DDE_ACK hwnd:002E0474 lPackedVal:001C33A8 wStatus:0000
aItem:33A8 ("#13224") [wParam:002E0474 lParam:001C33A8]

The documentation for the Lua get() command says the following:
"get() Prepends 'get.' to the front of a command string, sends it to Ecotect
and formats results into variables. Used for retrieving object properties."

So in Python I also perpend "get." to the front of the string  (but it does
_NOT_ work):

conversation.Exec("get.app.computer")

And I get this DDE message:

<00234> 00340408 P WM_DDE_EXECUTE hwnd:001C0494 lPackedVal:01A304EC
hCommands:01A304EC [wParam:001C0494 lParam:01A304EC]
<00235> 001C0494 P WM_DDE_ACK hwnd:00340408 lPackedVal:00236F28 wStatus:0000
aItem:6F28 ("#28456") [wParam:00340408 lParam:00236F28]

======================================================

I have tried a huge number of variants of this string - "get app.computer",
"get(app.computer)", "app.computer.get" etc etc- , but no luck.
>From the DDE documentation, I know the command string that Lua sends to
Ecotect is stored in hCommands, but I can't figure out how to see this
string...

Any suggestions?

Patrick






2009/6/19 Thomas Heller <theller at ctypes.org>

> Patrick Janssen schrieb:
> > Hi all,
> > I am having some trouble with controlling a Windows application through
> dde
> [...]
> > Does anyone know how I might be able to see the dde command strings that
> Lua
> > is sending to Ecotect (which all seem to work - I am thinking that there
> may
> > be an error in the documentation).
>
> The old DDESpy tool comes to mind.
>
> --
> Thanks,
> Thomas
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090619/fd6f6129/attachment.htm>


More information about the python-win32 mailing list