473,721 Members | 2,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1610
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

27
7120
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate a user from information you got from the session. Each secure app on a site must challenge the user for name and password, each and every time the user accesses it (not just once and then store it in the session). If a secure app is multi-page,...
20
10154
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
3
1397
by: Deano | last post by:
Thought it might be a cool feature to allow my users to click a button, and connect to a webpage that would tell them if a more recent version was available. I can create a button that opens a webpage but it would be nice if it could compare what they have with what I say is available, so I can say something like "You have version 1.2. Version 1.3 is now available". Any ideas?
19
32322
by: wetherbean | last post by:
Hi group..I am writing a playlist management protocol where I have a file that holds all the playlists and a file that holds all the songs....before a playlist is created I need to check to see if the playlist file is empty so that I can assign an integer value to a playlist id field if it is the first playlist being written to the file....can anyone help?? Thanks in advance wetherbean
4
3258
by: Anil | last post by:
Hi All, We have hundreds of images on our server. Depending on the ItemID (fetched from database) we display the image to the client. For ex. if the ItemID is 20045 then, we display the image 20045.jpg But for certain items, we don't have image. So, is it possible to check the image is available or no on the server. So, if the image is not available for certain item, then we want to display a default image for that item.
5
10855
by: LL | last post by:
Hi, Where is the best place to check the session's object, if it's null, then redirect the user to login page? put into every page's load event? Thanks.
0
284
by: Hermann Maier | last post by:
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...
7
2046
by: questions? | last post by:
I have a linked list of structures with pointers point to each other. I go through the list and use free() to free the structures one by one previous allocated by malloc(). After I did the whole thing. I tried to print the list again, it has exactly the same thing. Why I cannot free them? Sorry, I cannot post my huge program here. Thanks for any comments
25
29758
by: pamelafluente | last post by:
Hi Guys, I have the following HTML code which is doing a GET to a page, say MyUrl.aspx : <body> <form name="form1" method="get" action="MyUrl.aspx" id="form1"> <input type="hidden" name="ClickedElement" id="Messenger" /> </form> </body>
0
8840
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9064
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.