Home All Groups Group Topic Archive Search About

handling the death of a COM app from .NET

Author
24 Nov 2004 5:04 PM
Jiho Han
I have a winforms app that creates a COM application(namespace imported through references).
I would like to be able to know when the COM application is closed by the user in the .NET app.  The COM app does not fire an event when it's closing - there is no published event.

Is there a way to find out if the COM app is no longer available or not?  When the COM app is dead, the reference in .NET app is still valid, that is to say, it's not null.  So when I try to access a method or a property using the reference, I get a COMException - RPCServer is not available.

Additionally, when I try to closed the COM app, I get a messagebox saying that there are active COM objects in the application(in the COM app).  I am assuming that this is a feature of the COM app which I didn't write.  Can someone explain why this happens?  I am not very familiar with COM internals.  I would think the reference is from .NET to COM not the other way around.

Thanks much.

Jiho

Author
25 Nov 2004 6:56 AM
Ajay Kalra
This might apply to you as well:

http://www.dotnetinterop.com/faq/?q=OfficeCleanup
http://support.microsoft.com/?kbid=317109

-----------
Ajay Kalra
ajayka***@yahoo.com

"Jiho Han" <j***@infinityinfo.com> wrote in message
news:OAyW4ek0EHA.3452@TK2MSFTNGP14.phx.gbl...
> I have a winforms app that creates a COM application(namespace imported
through references).
> I would like to be able to know when the COM application is closed by the
user in the .NET app.  The COM app does not fire an event when it's
closing - there is no published event.
>
> Is there a way to find out if the COM app is no longer available or not?
When the COM app is dead, the reference in .NET app is still valid, that is
to say, it's not null.  So when I try to access a method or a property using
the reference, I get a COMException - RPCServer is not available.
>
> Additionally, when I try to closed the COM app, I get a messagebox saying
that there are active COM objects in the application(in the COM app).  I am
assuming that this is a feature of the COM app which I didn't write.  Can
someone explain why this happens?  I am not very familiar with COM
internals.  I would think the reference is from .NET to COM not the other
way around.
Show quote
>
> Thanks much.
>
> Jiho

AddThis Social Bookmark Button