Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
intpydde.py61 linesDownload Raw Back to framework
1# DDE support for Pythonwin2#3# Seems to work fine (in the context that IE4 seems to have broken4# DDE on _all_ NT4 machines I have tried, but only when a "Command Prompt" window5# is open.  Strange, but true.  If you have problems with this, close all Command Prompts!6 7 8import sys9import traceback10 11import win32api12import win32ui13from dde import *14from pywin.mfc import object15 16 17class DDESystemTopic(object.Object):18    def __init__(self, app):19        self.app = app20        object.Object.__init__(self, CreateServerSystemTopic())21 22    def Exec(self, data):23        try:24            # 			print "Executing", cmd25            self.app.OnDDECommand(data)26        except:27            t, v, tb = sys.exc_info()28            # The DDE Execution failed.29            print("Error executing DDE command.")30            traceback.print_exception(t, v, tb)31            return 032 33 34class DDEServer(object.Object):35    def __init__(self, app):36        self.app = app37        object.Object.__init__(self, CreateServer())38        self.topic = self.item = None39 40    def CreateSystemTopic(self):41        return DDESystemTopic(self.app)42 43    def Shutdown(self):44        self._obj_.Shutdown()45        self._obj_.Destroy()46        if self.topic is not None:47            self.topic.Destroy()48            self.topic = None49        if self.item is not None:50            self.item.Destroy()51            self.item = None52 53    def OnCreate(self):54        return 155 56    def Status(self, msg):57        try:58            win32ui.SetStatusText(msg)59        except win32ui.error:60            pass61 
codekingpro/portable-devtools · Team Ai