Is there any way or event in WPF to handle the kill from task manager?

Ghadmode, Sandeep 1 Reputation point
2021-03-30T14:54:09.073+00:00

I am working on WPF application. We save the state of the application to the registry when user closes the application. We use closing event of the window(this.Closing) to save the state of the application. But when user kills the application from the process manager/task manager, we don’t get this closing event. Thus we are not able to save the state in this case.

Is there any way or event in WPF which get fire when user kill the application from the process manager/task manager? So that we will be able to save the state of the application to the registry.

Best regards

Developer technologies Windows Presentation Foundation
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.