instance of COM-server with Win32all

  • Thread starter Michel Claveau/Hamster
  • Start date
M

Michel Claveau/Hamster

Hi !

I seek how to define a COM-server in "mono-instance". Do you know if there
are policies for that ?
I sought much, but did not find anything. And i had difficult with english.

Python is great, Win32all is brilliant, but i am wedged in a corner.


* and sorry for my bad english * Babelfish was a great help *


@-salutations
 
M

Mark Hammond

Michel said:
Hi !

I seek how to define a COM-server in "mono-instance". Do you know if there
are policies for that ?
I sought much, but did not find anything. And i had difficult with english.

Python is great, Win32all is brilliant, but i am wedged in a corner.


* and sorry for my bad english * Babelfish was a great help *

I think you are asking how to create a "singleton" using win32com. The
simplest way is to *pretend* you have created one.

Consider an object setup like this:

class RealObject:
def foo(self)...
def bar(self)...

realObject = RealObject()

class COMOBject:
_public_methods_ = "foo", "bar"
def foo(self):
realOBject.foo()
def bar(self):
realObject.bar()

In this case, it doesn't matter how many "COMObject" objects are alive,
as they will always delegate to the single "RealObject".

If you want a true singleton, you will need to dig a little deeper into
win32com, and create your own "policy".

Mark.
 
M

Michel Claveau/Hamster

Hi !

Thanks for your read of my message. Indeed, I seek a "global singleton". Il
have try singleton-tech, but when differents soft call my python-COM-server,
i obtain differents singleton (sic).

I want have an persistant-dictionary, common to all task on one computer.

I have look other softs :
- MsWord have an "handle instance" (!?)
- Delphi requires, at the beginning of an COM/OLE-project, to choose
"mono-instance" or "multi-instance".



For the moment, I circumvented the problem with a local-TCP/IP-server,
common to all the softwares of the computer, but if it's possible, I prefer
to integrate that in my COM-server. Can I hope for a solution with win32all
?

In all the cases, thank you very much, for your works, and forgive my bad
English.

@-salutations
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,171
Messages
2,570,936
Members
47,472
Latest member
KarissaBor

Latest Threads

Top