[2008] On Program Crashing Do Something??
Im building an IRC Client, but Im having a problem, if my client crashes or I stop it without sending the msg QUIT to the server, the server still thinks im connected (until it sends the PING)
anyway, is there anyway to send the QUIT msg before crashing?
like if program is about to crash send QUIT msg ???
:S
thanks for help
Re: [2008] On Program Crashing Do Something??
Handle the UnhandledException event of the application. Note that this event is not raised while debugging because the debugger itself handles unhandled exceptions, but it will be in a Release build.
Re: [2008] On Program Crashing Do Something??
could u please give me an example?
Re: [2008] On Program Crashing Do Something??
You don't need me to do it for you when you have access to the MSDN Library. Microsoft has already provided all the information you need. This was one of the first results returned by a search for unhandledexception event. My advice to you, as to everyone else, is to try for yourself first, then ask if you're unable. If you haven't consulted the MSDN Library for a question relating to .NET development then you haven't really done all you can.
Re: [2008] On Program Crashing Do Something??
This is probably not a good way to do it but i used this a while back when i made a tcpServer. Just add whatever from the code below on the main form's formclosing event:
Code:
Select Case e.CloseReason
Case CloseReason.ApplicationExitCall
'send quit
Case CloseReason.FormOwnerClosing
'send quit
Case CloseReason.MdiFormClosing
'send quit
Case CloseReason.None
'send quit
Case CloseReason.TaskManagerClosing
'send quit
Case CloseReason.UserClosing
'send quit
Case CloseReason.WindowsShutDown
'send quit
End Select
Re: [2008] On Program Crashing Do Something??
Quote:
Originally Posted by ^^vampire^^
This is probably not a good way to do it but i used this a while back when i made a tcpServer. Just add whatever from the code below on the main form's formclosing event:
Code:
Select Case e.CloseReason
Case CloseReason.ApplicationExitCall
'send quit
Case CloseReason.FormOwnerClosing
'send quit
Case CloseReason.MdiFormClosing
'send quit
Case CloseReason.None
'send quit
Case CloseReason.TaskManagerClosing
'send quit
Case CloseReason.UserClosing
'send quit
Case CloseReason.WindowsShutDown
'send quit
End Select
Why you use select case, if you want to send quit in all cases?
Quote:
Select Case e.CloseReason
When CloseReason doesn't matter ;)
The question is: "How to notice, if the app. closed"
Re: [2008] On Program Crashing Do Something??
where do i put this code?
Re: [2008] On Program Crashing Do Something??
Wow... i wasn't even thinking when i posted that one... ignore me i've gone crazy... thats more for specifying different methods for different close reasons... my bad!
Anyway for your main form in the FormClosing event add the code to send quit text. Not quite sure if that will work properly but i seem to have gotten good results from it.
Re: [2008] On Program Crashing Do Something??
Quote:
Originally Posted by perito
where do i put this code?
Did you follow the link I provided? It provides SPECIFIC instructions for handling the UnhandledException event.