I have this C# app which starts at system boot in the tray, and i have the following problem with it, only on Windows XP
I can’t restart the PC while the application is running. If I use file > exit, it stops ok and then i can restart. but if i try restarting with the application open, it just won’t do it
I tried adding this in the main window constructor, dunno if its the right thing to do:
Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
and the OnApplicationExit function does the app’s shutting down procedure.. but that doesn’t help
any ideas?
Do you have a
FormClosingevent handler somewhere where you do something likee.Cancel = true;?If so, change it to first look at the close reason to decide if it should cancel or not as:
There might be other CloseReasons where you should also not Cancel the closing so might be worth looking at MSDN for that.