Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there an event that still fires after crash?

Status
Not open for further replies.

Sypher2

Programmer
Oct 3, 2001
160
US
I have an application that uses an invisible instance of Excel. I would like Excel to close even if the application crashes. This is mainly for debugging since crashes leaves Excel processes running which have to be manually stopped in Task Manager.

I had seen the OnHandleDestroyed event is supposed to fire even if an application crashes or otherwise closes ungracefully. However, this is not doing the trick.

Is there any closing type event which will fire even if the application crashes?

 
I beleive Dispose will always attempt to fire. but you may want to try useing try blocks any place that excel is open. Then, if you hit an error, catch it, close excel and report it instead of letting your app die.

-Rick

----------------------
 
Depends on the nature of the crash.

An unhandled exception (which you should code against, BTW) will likely allow a GC to run and have things clean up.

A Win32 crash (Dr. Watson appears) will free any Win32 objects, but will not allow any .net based cleanup code to run (the runtime has died and the OS nukes it).

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top