how to detect that a process is being close by a task manager
-
is there any way to identify that the process is being close by task manager? (not in the application tab but in the process tab) im using the formclosed event of the form but it doest work.. Private Sub frmMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Select Case e.CloseReason Case CloseReason.ApplicationExitCall MsgBox("Notify") Case CloseReason.FormOwnerClosing MsgBox("Notify") Case CloseReason.MdiFormClosing MsgBox("Notify") Case CloseReason.None MsgBox("Notify") Case CloseReason.TaskManagerClosing MsgBox("Notify") Case CloseReason.UserClosing MsgBox("Notify") Case CloseReason.WindowsShutDown MsgBox("Notify") End Select but it doesnt work when i closed the form in process tab(Task Manager).. :confused: -- modified at 1:57 Thursday 14th December, 2006
-
is there any way to identify that the process is being close by task manager? (not in the application tab but in the process tab) im using the formclosed event of the form but it doest work.. Private Sub frmMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Select Case e.CloseReason Case CloseReason.ApplicationExitCall MsgBox("Notify") Case CloseReason.FormOwnerClosing MsgBox("Notify") Case CloseReason.MdiFormClosing MsgBox("Notify") Case CloseReason.None MsgBox("Notify") Case CloseReason.TaskManagerClosing MsgBox("Notify") Case CloseReason.UserClosing MsgBox("Notify") Case CloseReason.WindowsShutDown MsgBox("Notify") End Select but it doesnt work when i closed the form in process tab(Task Manager).. :confused: -- modified at 1:57 Thursday 14th December, 2006
There are a few different methods TaskManager TRIES on the Applications tab before doing the brute force "halt execution and free the memory" method. This last-ditch method is what the Processes tab uses when it "kills" a process. It isn't detectable by your code since your process ceases to execute when TaskManager obliterates the Process using this method.
Dave Kreskowiak Microsoft MVP - Visual Basic
-
is there any way to identify that the process is being close by task manager? (not in the application tab but in the process tab) im using the formclosed event of the form but it doest work.. Private Sub frmMain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Select Case e.CloseReason Case CloseReason.ApplicationExitCall MsgBox("Notify") Case CloseReason.FormOwnerClosing MsgBox("Notify") Case CloseReason.MdiFormClosing MsgBox("Notify") Case CloseReason.None MsgBox("Notify") Case CloseReason.TaskManagerClosing MsgBox("Notify") Case CloseReason.UserClosing MsgBox("Notify") Case CloseReason.WindowsShutDown MsgBox("Notify") End Select but it doesnt work when i closed the form in process tab(Task Manager).. :confused: -- modified at 1:57 Thursday 14th December, 2006
No, there isn't. You code STOPS executing, immediately. You don't have any way of detecting this if your no longer running.
Dave Kreskowiak Microsoft MVP - Visual Basic