Is a method such as OnClosed(EventArgs e)
called?
Update
Ended up using code from the following url:
http://osdir.com/ml/windows.devel.dotnet.clr/2003-11/msg00214.html
Is a method such as OnClosed(EventArgs e)
called?
Update
Ended up using code from the following url:
http://osdir.com/ml/windows.devel.dotnet.clr/2003-11/msg00214.html
No, since there is no message pump for a close event.
However, the AppDomain is unloaded as the process is torn down, and this will fire AppDomain.DomainUnloaded. You can use that to trap an event as the program shuts down.
There is the AppDomain.ProcessExit
event that you could hook up an event handler to. Note thought that it is "time boxed"; by default it is allowed to execute for a maximum of 3 seconds, so you should not do anything time consuming in there.
Take a look at this article/post.
Essentially, you hook up with the SetConsoleCtrlHandler and subscribe to the events.