I have a windows forms application and i need to write few items to a log file when the user kills the application from task manager. How can I achieve this?
Note: Even though FormClosingEventArgs in Form1_FormClosing event has the TaskManagerClosing functionality but that is not getting triggered while ending the task from task manager. Given below is my code segment written under Form1_FormClosing event.
switch (e.CloseReason)
{
case CloseReason.TaskManagerClosing:
Writer.Log("xyz: " + xyz);
break;
}
Comments
Post a Comment