mardi 24 février 2015

Exit Event in a Windows Forms Application?

Yeah I know - one of the following lines will do this usually:



AppDomain.CurrentDomain.ProcessExit += OnApplicationExit;
Application.ApplicationExit += OnApplicationExit;

void OnApplicationExit(object sender, EventArgs eventArgs) { ... }


But what when one don't use any forms? To make it a hidden windows application - which is not a service. Both of the above examples don't work for me.



public static void Main()
{
InitMyApp();
Application.Run();
}

Aucun commentaire:

Enregistrer un commentaire