Closing From
-
I remember that in vb6 there was a way to get where a form close was called from (ie. clicked x, computer shut down etc.) Is there a way to get this in .net.
How on earth would you get the fact that the form had been shut down by the computer shutting down ? A modal form has a DialogResult, which is some help, but not as much as you're hoping, I don't think. Christian Graus - Microsoft MVP - C++
-
How on earth would you get the fact that the form had been shut down by the computer shutting down ? A modal form has a DialogResult, which is some help, but not as much as you're hoping, I don't think. Christian Graus - Microsoft MVP - C++
-
I remember that in vb6 there was a way to get where a form close was called from (ie. clicked x, computer shut down etc.) Is there a way to get this in .net.
I have started a project to do it. I am overriding WndProc and catching some of the messages. I am having trouble figuring out which ones though. I have this so far.
MyBase.WndProc(m) Select Case m.Msg Case Is = Win32.WindowsMessages.WM_QUERYENDSESSION f = New UnloadModeEventArgs(ECloseMode.AppWindows, False) Case Is = Win32.WindowsMessages.WM_SYSCOMMAND If m.WParam.ToInt32 = Win32.WindowsMessages.SC_CLOSE Then f = New UnloadModeEventArgs(ECloseMode.FormControlMenu, False) End If End Select
-
How on earth would you get the fact that the form had been shut down by the computer shutting down ? A modal form has a DialogResult, which is some help, but not as much as you're hoping, I don't think. Christian Graus - Microsoft MVP - C++
Windows sends a message to all open applications on the event of a shutdown.
-
The form QueryUnload has a variable called UnloadMode As Integer that could be used to tell you where the unload was called..check it out. It seems they removed this in .Net, bummerr.
You can do this by overriding the wndproc method and checking for WM_QUERYENDSESSION
-
Windows sends a message to all open applications on the event of a shutdown.
Yeah, I know that. But I read the question to be, how to tell how something WAS shut down, not how to tell that something is BEING shut down. So, a child dialog is closed, and the parent works out why. Christian Graus - Microsoft MVP - C++