check if com api is still available

Chris Mellon arkanes at gmail.com
Fri Nov 18 16:43:04 EST 2005


On 11/18/05, Neil Hodgson <nyamatongwe+thunder at gmail.com> wrote:
> Hermann Maier:
>
> > i am using the com api of a program and if this program is shut down and
> > my program calls a method of the api, it crashs. that means, i need to
> > check, if the com server is still available, before i can call for it.
>
>     The server should not shut down while clients have outstanding
> references to objects within it.
>

The Excel COM object has this behavior - if you call the Quit() method
or (if you're controlling an interactive instance) the excel window is
closed, further calls to the COM object will throw errors. I couldn't
find a solution to this other than to just make sure you didn't do
that. However, I didn't know about the ROT and maybe that will work.

> > but i would prefer a
> > solution that is more clean from the beginning. perhaps there is a
> > windows event that can tell me, wenn the other application, that hosts
> > the com server, is closed or perhaps i can do something with the guid of
> > the com server, maybe there is a call where i can check, if a certain
> > com server is available.
>
>     All running COM servers should be in the "Running Object Table"
> (ROT). If you search the net for this term you will find code that can
> show what is in the ROT, so there must be an API.
>
>     Neil
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list