Terminating a local process COM server
sholden at holdenweb.com
Fri Jun 29 09:11:09 EDT 2001
"Duncan Booth" <duncan at NOSPAMrcp.co.uk> wrote ...
> "Steve Holden" <sholden at holdenweb.com> wrote:
> > For efficiency reasons I am implementing a credit-card checking
> > algorithm as a COM LocalServer object.
[ questions about stopping a COM LocalServer started automatically]
> In principle you could query the registry to work out the name of the EXE
> file and then find the relevant process and kill it. In practice this gets
> difficult if you find more than one matching EXE file: this is especially
> problem with COM objects written in Python, as there are quite likely to
> other Python or PythonW processes lying around.
> Another option would be to put the COM object into an NT service. That way
> you can simply stop and start the service at will. I recently wrote a
> service containing a COM object, let me know if you want a copy of the
> code. The downside to this is that it makes it harder to debug the service
> when things go wrong.
Hmmm. It's not as simple as I at first believed. I thought running a service
might be a good way to go, but of course this begs the question of how to
communicate with the service! The reason I wanted to go for a COM server was
vecause COM is integrated into all the Windows-based architecture (ASP, VB,
etc) that my client currently uses, so it's easy to use COM to create
onjects which perform useful services.
So, if anyone knows the secret of terminating a LocalServer process I'm
More information about the Python-list