check if com api is still available

Hermann Maier benutzer at beispiel.de
Fri Nov 18 09:43:14 EST 2005


Hi,

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.

i already have a solution for this problem and it works quiet well, but 
i think, it is not that nice. my solution works that way, that i create 
a new thread, call a method of my com object and write back a value in 
my main object. that means, if the method call fails, only the thread 
crashes, not my whole program. if the method call succeeds, i can write 
back my value in my main object and so i know, if the thread crashes or 
not. the thing that is not nice about it is, that the thread remains in 
the memory.

perhaps there is a possibility to kill this thread, 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.

thank you for your help, Maier.



More information about the Python-list mailing list