[python-win32] Sending raw bytes with DDE server

Dave Cook daverz at gmail.com
Mon Oct 28 14:52:38 CET 2013


I have to interface some Python code with some ancient DDE clients.  One of
the Requests requires a struct.  I tried using the struct.pack from the
struct module, but data gets cut off at the first inevitable NULL byte.

class MyTopic(object.Object):

    def __init__(self, topicName):
        topic = dde.CreateTopic(topicName)
        topic.AddItem(dde.CreateStringItem(""))
        object.Object.__init__(self, topic)
        self.topicName = topicName

    def Request(self, req):
         if req=='STATUS':
         vals = range(1, 5)
         result = struct.pack('lffff', *vals)
         return result
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20131028/32f6cc14/attachment.html>


More information about the python-win32 mailing list