M
mdb
I have an app that I want to keep open (and hidden with an icon in the
taskbar) when the user presses the 'X' close window button. So I capture
the Closing event on the form and check a bool variable, which if set, sets
e.Cancel on the ClosingEventArgs and sets the Form.Visible=false and the
Form.ShowInTaskbar=false. I have a menu item in the window that allows the
user to actually exit the program by unsetting the bool and then exiting.
The problem is that this apparently prevents the computer from shutting
down, because the e.Cancel is getting set during a shutdown operation. How
can I determine when it is the system requesting closure of the window
instead of the user?
-mdb
taskbar) when the user presses the 'X' close window button. So I capture
the Closing event on the form and check a bool variable, which if set, sets
e.Cancel on the ClosingEventArgs and sets the Form.Visible=false and the
Form.ShowInTaskbar=false. I have a menu item in the window that allows the
user to actually exit the program by unsetting the bool and then exiting.
The problem is that this apparently prevents the computer from shutting
down, because the e.Cancel is getting set during a shutdown operation. How
can I determine when it is the system requesting closure of the window
instead of the user?
-mdb