Im using the following code to launch an 'attachment' from my program and attach the Exited event handler to it so i know when it has been closed. This way i can then delete the temporary file that i had to create (the attachment is a byte array until they choose to open it).
|
My issue is it doesn't fire all the time. If its a .txt and opens in notepad, the event fires fine. If its an .xls and opens in excel, the event is not fired. Why would this be? Is there perhaps a better way of deleting a temporary file?
Any help would be appriciated!
Sam HobbsPosted Jul 2, 2010, 9:42 PM
Perhaps what is happening is that the process executes, then passes the document to another instance, then exits; all so fast that the Exited event is not executed. That is only a guess and is probably not happening, but it is a guess.
Are you sure that the Exited event does not execute, or are you assuming it is not executed just because the file does not get deleted?