FOLLOW US
softpcapps Software CODE HELP BLOG

Shareware and free Open Source Windows Software Applications and free Online Tools

How to execute a Function when the Application exits

To execute a function automatically when the application exits it is necessary to add a process exit event handler like in the following code :
	
	
	 AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
 
 
	 void CurrentDomain_ProcessExit(object sender, EventArgs e)
	{
		System.Windows.Forms.MessageBox.Show("Exiting..");
	}