I am developing a standalone app and need to do some action(Exactly I need to post some request on some URL) when user loggs out the system..
I've tried to achieve this with Application.ApplicationExit
and AppDomain.CurrentDomain.ProcessExit
events or with destructors but non of this seems to work.
I would be grateful for some hint on how to do it.
Here is some snippet from my main function:
[STAThread]
static void Main()
{
...
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ApplicationExit += Application_ApplicationExit;
AppDomain.CurrentDomain.ProcessExit += Application_ApplicationExit;
Application.Run();
}
static void Application_ApplicationExit(object sender, EventArgs e)
{
File.Create("C:\\kod\\test5.txt");
}
I am trying to test this behaviour with creating file(easier to see the results).
Hope this time it will be more clear.