FOLLOW US
4dots Software CODE BLOG

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..");
	}
	

 

Please Donate!

Please Share!