want to test when os is shutting down

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

Hello:
In vb.net - dot.net 2.0
I have a windows form app that on the Me.FormClosing event, I do an e.cancel

This results in the OS not shuting down or rebooting until the my app has
exited - which is a manual process.

What I want is:
1) check is the OS has initiated the Me.formclosing and if so, jump over the
e.cancel

When I shutdown the OS,
MsgBox(System.Environment.HasShutdownStarted.ToString) returns false

What do you suggest

Thank you

T
 
Terry said:
What I want is:
1) check is the OS has initiated the Me.formclosing and if so, jump over the
e.cancel

Check e.Reason to see if it equals CloseReason.WindowsShutDown
 
Back
Top