469,936 Members | 2,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,936 developers. It's quick & easy.

check if com api is still available

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.
Nov 22 '05 #1
6 1421
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.
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
Nov 22 '05 #2
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.
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
Nov 22 '05 #3
On 11/18/05, Neil Hodgson <ny*****************@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

Nov 22 '05 #4
On 11/18/05, Neil Hodgson <ny*****************@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

Nov 22 '05 #5
Neil Hodgson <ny*****************@gmail.com> wrote:

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.


If only. The Microsoft Office applications seem to be the only ones in the
world that use the ROT.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 22 '05 #6
Neil Hodgson <ny*****************@gmail.com> wrote:

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.


If only. The Microsoft Office applications seem to be the only ones in the
world that use the ROT.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Nov 22 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

27 posts views Thread by mrbog | last post: by
19 posts views Thread by wetherbean | last post: by
5 posts views Thread by LL | last post: by
reply views Thread by Hermann Maier | last post: by
7 posts views Thread by questions? | last post: by
25 posts views Thread by pamelafluente | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.