I'm using VS 2010, winForm.
Can someone suggest how to run method when program process is ended?
I tried: How to run code before program exit? solution, but it only works is I close form by "close button" if I end process in task-manager it is not called, is it possible to handle such event?
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
AppDomain.CurrentDomain.ProcessExit += new EventHandler (OnProcessExit);
}
public static void OnProcessExit(object sender, EventArgs e)
{
if (Utils.RemindTime != DateTime.MinValue)
Utils.SetStartup(true);
}