|
我有一个python的DDE test server
import win32ui
from pywin.mfc import object
import dde
class MySystemTopic(object.Object):
def __init__(self):
object.Object.__init__(self, dde.CreateServerSystemTopic())
def Exec(self, cmd):
print "System Topic asked to exec", cmd
class MyOtherTopic(object.Object):
def __init__(self, topicName):
object.Object.__init__(self, dde.CreateTopic(topicName))
def Exec(self, cmd):
print "Other Topic asked to exec", cmd
class MyRequestTopic(object.Object):
def __init__(self, topicName):
topic = dde.CreateTopic(topicName)
topic.AddItem(dde.CreateStringItem(""))
object.Object.__init__(self, topic)
def Request(self, aString):
print "Request Topic asked to compute length of:", aString
return(str(len(aString)))
server = dde.CreateServer()
server.AddTopic(MySystemTopic())
server.AddTopic(MyOtherTopic("RunAnyCommand"))
server.AddTopic(MyRequestTopic("ComputeStringLength"))
server.Create('RunAny')
while 1:
win32ui.PumpWaitingMessages(0, -1)
在zmud 4.62 里面执行#DDE RunAny RunAnyCommand hihihi ,能够看到python里面print出来"Other Topic asked to exec hihihi".
用函数%dde, %ddeopen, %ddepoke,在mud里面都只显示“什么?”。显然是函数无法调用。
谁能告诉一下到底应该怎么用dde函数从一个dde server里面获取值? |
|