Beispiel #1
0
class IPCWin32DDE(IPC):
    def create(self):
        self.server = None

        # try to connect first
        self.client = Server(None, None, dde.CreateServer())
        self.client.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCMD_CLIENTONLY)
        self.conversation = dde.CreateConversation(self.client)
        try:
            self.conversation.ConnectTo(app_name, "controlsocket")
            raise BTFailure(_("DDE Conversation connected."))
        except dde.error, e:
            # no one is listening
            pass

        # clean up
        self.client.stop()
        del self.client
        del self.conversation

        # start server
        self.server = Server(self.log, self.handle_command, dde.CreateServer())
        self.server.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCLASS_STANDARD)
        self.server.AddTopic(
            Topic(self.handle_command, dde.CreateTopic("controlsocket")))
Beispiel #2
0
class IPCWin32DDE(IPC):
    def create(self):
        self.server = None

        if g_mutex.IsAnotherInstanceRunning():
            # test whether there is a program actually running that holds
            # the mutex.
            for i in xrange(10):
                # try to connect first
                self.client = Server(None, dde.CreateServer())
                self.client.Create(
                    app_name,
                    dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCMD_CLIENTONLY)
                self.conversation = dde.CreateConversation(self.client)
                try:
                    self.conversation.ConnectTo(app_name, self.name)
                    raise BTFailure("DDE Conversation connected.")
                except dde.error, e:
                    # no one is listening
                    pass

                # clean up
                self.client.stop()
                del self.client
                del self.conversation
                ipc_logger.warning(
                    "No DDE Server is listening, but the global mutex exists. Retry %d!"
                    % i)
                time.sleep(1.0)

                # oh no you didn't!
                if i == 5:
                    pykill.kill_process(app_name)

            # continuing might be dangerous (two instances)
            raise Exception(
                "No DDE Server is listening, but the global mutex exists!")

        # start server
        self.server = Server(self.handle_command, dde.CreateServer())
        self.server.Create(
            app_name, dde.CBF_FAIL_SELFCONNECTIONS | dde.APPCLASS_STANDARD)
        self.server.AddTopic(
            Topic(self.handle_command, dde.CreateTopic(self.name)))
Beispiel #3
0
 def __init__(self, topicName):
     topic = dde.CreateTopic(topicName)
     topic.AddItem(dde.CreateStringItem(""))
     object.Object.__init__(self, topic)
Beispiel #4
0
 def __init__(self, topicName):
     object.Object.__init__(self, dde.CreateTopic(topicName))
Beispiel #5
0
 def __init__(self, topicName):
     self.topic = dde.CreateTopic(topicName)
     object.Object.__init__(self, self.topic)
     self.items = {}
Beispiel #6
0
 def __init__(self, parent):
     self.parent = parent
     topic = dde.CreateTopic(self.parent.topic_name)
     topic.AddItem(dde.CreateStringItem(""))
     pywin.mfc.object.Object.__init__(self, topic)