Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2004

Tip: Looking for answers? Try searching our database.

handling the death of a COM app from .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jiho Han - 24 Nov 2004 17:04 GMT
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
Ajay Kalra - 25 Nov 2004 06:56 GMT
This might apply to you as well:

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

-----------
Ajay Kalra
ajaykalra@yahoo.com

> 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
Jiho Han - 29 Nov 2004 15:43 GMT
Thanks for the links but those links address a situation where you close the external app from within the .NET app.
My situation is a bit different.  The external app may be closed by the user at any time (or maybe even die for some reason) and I need to know when that happens.

Right now, the only way that I've been able to do this is to wrap the whole region that deals with the external app in a try-catch block and if it fails with COMException, I know it's dead.  I was wondering whether there is a better solution.

Thanks much.

> This might apply to you as well:
>
[quoted text clipped - 35 lines]
>>
>> Jiho

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.