.net - Different reasons for winforms closing event -


how can tell if closing() event in powershell winform app raised because windows shutdown initiated?

i tried subscribing systemevents sessionending , sessionended closing event occurs before do.

i read somewhere windows sends wm_endsession message applications when shutdown/restart initated. how can query inside on_closing function (with powershell)?

got it: eventargs of closing-event contain closereason, can queried after event has been fired. value userclosing , in case in question windowsshutdown.

links:

manage event subscriptions powershell

msdn: formclosingeventargs

msdn: closereason


Comments