Singleton COM local/remote server?
John Lull
lull at acm.org
Thu Jul 6 01:49:04 EDT 2000
Alex Martelli wrote (with possible deletions):
> I'm not sure how this translates to Python's implementation
> of COM, but, at a lower abstraction level, this is exactly
> what is accomplished by passing the REGCLS_MULTIPLEUSE value
> as the "flags" parameter in the CoRegisterClassObject calls
> that an .EXE does, at startup, to let the Service Control
> Manager of COM know about its class-objects (IClassFactory
> instances).
> Now, there remains the issue of, how to control the flags
> used on CoRegisterClassObject by pythonw.exe...? I can't
> find it in the docs (which doesn't mean it isn't there...
> it just says I can't find it). Maybe we need to look at
> the sources...?
I replied (with capitalization corrected):
> It seems to be passed as the third command line argument to
> localserver.py, which calls RegisterClassFactories(), which
> in turn calls CoRegisterClassObject().
> localserver.py is apparently run anytime you start a Python
> local server. Now I just need to figure out how to set up
> the command line arguments -- I suspect it's something set
> in the registry during installation.
If I had simply looked a little further, I would have noticed that if
you don't specify flags and/or clsctx to RegisterClassFactories:
flags defaults to REGCLS_MULTIPLEUSE | REGCLS_SUSPENDED
clsctx defaults to CLSCTX_LOCAL_SERVER
and localserver.py promptly calls CoResumeClassObjects() after
RegisterClassFactories(), which I think is precisely what I wanted.
Looks like I'm all set, until I want to write a local server that can
have *multiple* instances running simultaneously.
Thanks much.
Regards,
John
More information about the Python-list
mailing list