Hi Mickey,
No unforutnately not at least just using code in the Closing() event
handler. However, you can use WndProc to check for the system shutdown then
set a flag that the system is trying to shut down the app.
Something like this:
protected override void WndProc(ref Message m)
{
if (this.bNotifyIcon)
{
const int WM_QUERYENDSESSION = 0x011;
if (m.Msg == WM_QUERYENDSESSION)
this.bWindowsShuttingDown = true;
}
base.WndProc(ref m);
}
In this case I use to trap the ShutDown event when the app is running in
NotifyIcon mode because usually when you shut down the form in that mode you
don't want to shut it down but minimize to the tray. The shut down message
however should need to be handled.
+++ Rick ---
--
Rick Strahl
West Wind Technologies
http://www.west-wind.com/ http://www.west-wind.com/webblog/
----------------------------------
Making waves on the Web
"Mickey Swanson" <sw*****@dixie-net.com> wrote in message
news:uN**************@TK2MSFTNGP09.phx.gbl...
Is there any way to determing why a form is closing? As in if the user
cliced the x button or if a system shutdown has started.
thanks for any help
Mickey Swanson