|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
catch the process terminate from the task managerIs there a way to catch the event of terminating the application from the the
processes tab in task manager? I have created windows app, and if a user termintates the app in the task manager, I'd like to be notified. I tried few combinations of Close, Closing, Application.Exit method, ApplicationExit Event, etc, but nothing seems to be working. Thanks in advance Strah@Langan well you should be able to catch this in the form`s closing event
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing e.CloseReason.TaskManagerClosing End Sub regards Michel Posseth [MCP] Show quoteHide quote "Strah" <St***@discussions.microsoft.com> schreef in bericht news:9509273D-2031-40B3-A731-E2F6417DCE50@microsoft.com... > Is there a way to catch the event of terminating the application from the > the > processes tab in task manager? > > I have created windows app, and if a user termintates the app in the task > manager, I'd like to be notified. I tried few combinations of Close, > Closing, > Application.Exit method, ApplicationExit Event, etc, but nothing seems to > be > working. > > Thanks in advance > Strah@Langan Michel,
thanks for your response. It would be too good if it was that easy, but this works only if you End Task (kill application) in the Application tab, but not if you End Process (kill process) in the Processes tab of Task Manager. There have obviously been few significant upgrades between VS.NET 2002 and VS.NET 2005. I am still maintaining my application in VS.NET 2002 where e.CloseReason does not exist yet, but have installed VS.NET 2005 on other machine so I could test your suggestion. We will soon distribute .NET framework 2.0 company wide, so I will finaly be able to migrate my windows application to VS.NET 2005 version in which I am able to test for e.CloseReason.TaskManagerClosing, which is exactly what I needed, BUT ONLY if it worked in the Processes tab of Task Manager. I am very confused that this new powerfull feature does not work in the Processes tab. Any reason for that? Or can I make it work if the process is killed (End Process). Or is there any other way to get notified when the process is killed from the Task Manager - Processes tab? Thanks, Strah@langan Show quoteHide quote "Michel Posseth [MCP]" wrote: > > well you should be able to catch this in the form`s closing event > > Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As > System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing > > e.CloseReason.TaskManagerClosing > > End Sub > > > > regards > > > > Michel Posseth [MCP] > > > > "Strah" <St***@discussions.microsoft.com> schreef in bericht > news:9509273D-2031-40B3-A731-E2F6417DCE50@microsoft.com... > > Is there a way to catch the event of terminating the application from the > > the > > processes tab in task manager? > > > > I have created windows app, and if a user termintates the app in the task > > manager, I'd like to be notified. I tried few combinations of Close, > > Closing, > > Application.Exit method, ApplicationExit Event, etc, but nothing seems to > > be > > working. > > > > Thanks in advance > > Strah@Langan > > > aha well you can`t catch the termination of your app when it is killed
through end process as the app is forcefully killed ( equivalant as your app is ended with the END statement ( verry bad to use this ) ) It is inmediatly unloaded without running or triggering termination and cleanup events you can only detect this with running a watcher app or something ( query the processes lost once in a while ) hmm when i think of this you could create a small executable wich only task is to check if your app is alive , your app in it`s turn will query the process list to make sure it`s guardian is running and if not start it with a process start command . so it is possible but not through your own program you need a second process by the way you called this feature new ,,, i used this a lot in my VB6 days seems MS has still some catching up todo before VS.net has everything that VB6 already had . regards michel posseth Show quoteHide quote "Strah" <St***@discussions.microsoft.com> schreef in bericht news:E660E6C1-D9CD-4C68-B545-9F64A96AF78A@microsoft.com... > Michel, > > thanks for your response. It would be too good if it was that easy, but > this > works only if you End Task (kill application) in the Application tab, but > not > if you End Process (kill process) in the Processes tab of Task Manager. > > There have obviously been few significant upgrades between VS.NET 2002 and > VS.NET 2005. I am still maintaining my application in VS.NET 2002 where > e.CloseReason does not exist yet, but have installed VS.NET 2005 on other > machine so I could test your suggestion. > > We will soon distribute .NET framework 2.0 company wide, so I will finaly > be > able to migrate my windows application to VS.NET 2005 version in which I > am > able to test for e.CloseReason.TaskManagerClosing, which is exactly what I > needed, BUT ONLY if it worked in the Processes tab of Task Manager. > > I am very confused that this new powerfull feature does not work in the > Processes tab. Any reason for that? Or can I make it work if the process > is > killed (End Process). Or is there any other way to get notified when the > process is killed from the Task Manager - Processes tab? > > Thanks, > > Strah@langan > > > > > > "Michel Posseth [MCP]" wrote: > >> >> well you should be able to catch this in the form`s closing event >> >> Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As >> System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing >> >> e.CloseReason.TaskManagerClosing >> >> End Sub >> >> >> >> regards >> >> >> >> Michel Posseth [MCP] >> >> >> >> "Strah" <St***@discussions.microsoft.com> schreef in bericht >> news:9509273D-2031-40B3-A731-E2F6417DCE50@microsoft.com... >> > Is there a way to catch the event of terminating the application from >> > the >> > the >> > processes tab in task manager? >> > >> > I have created windows app, and if a user termintates the app in the >> > task >> > manager, I'd like to be notified. I tried few combinations of Close, >> > Closing, >> > Application.Exit method, ApplicationExit Event, etc, but nothing seems >> > to >> > be >> > working. >> > >> > Thanks in advance >> > Strah@Langan >> >> >> hmm it seems I need to create a service to guard my application... a bit
disappointing, but thanks for your input Show quoteHide quote "Michel Posseth [MCP]" wrote: > aha well you can`t catch the termination of your app when it is killed > through end process > as the app is forcefully killed ( equivalant as your app is ended with the > END statement ( verry bad to use this ) ) > > It is inmediatly unloaded without running or triggering termination and > cleanup events > > you can only detect this with running a watcher app or something ( query the > processes lost once in a while ) > hmm when i think of this > > you could create a small executable wich only task is to check if your app > is alive , your app in it`s turn will query the process list to make sure > it`s guardian is running and if not start it with a process start command . > > so it is possible but not through your own program you need a second process > > by the way you called this feature new ,,, i used this a lot in my VB6 days > seems MS has still some catching up todo before VS.net has everything that > VB6 already had . > > > regards > michel posseth > > > > > "Strah" <St***@discussions.microsoft.com> schreef in bericht > news:E660E6C1-D9CD-4C68-B545-9F64A96AF78A@microsoft.com... > > Michel, > > > > thanks for your response. It would be too good if it was that easy, but > > this > > works only if you End Task (kill application) in the Application tab, but > > not > > if you End Process (kill process) in the Processes tab of Task Manager. > > > > There have obviously been few significant upgrades between VS.NET 2002 and > > VS.NET 2005. I am still maintaining my application in VS.NET 2002 where > > e.CloseReason does not exist yet, but have installed VS.NET 2005 on other > > machine so I could test your suggestion. > > > > We will soon distribute .NET framework 2.0 company wide, so I will finaly > > be > > able to migrate my windows application to VS.NET 2005 version in which I > > am > > able to test for e.CloseReason.TaskManagerClosing, which is exactly what I > > needed, BUT ONLY if it worked in the Processes tab of Task Manager. > > > > I am very confused that this new powerfull feature does not work in the > > Processes tab. Any reason for that? Or can I make it work if the process > > is > > killed (End Process). Or is there any other way to get notified when the > > process is killed from the Task Manager - Processes tab? > > > > Thanks, > > > > Strah@langan > > > > > > > > > > > > "Michel Posseth [MCP]" wrote: > > > >> > >> well you should be able to catch this in the form`s closing event > >> > >> Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As > >> System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing > >> > >> e.CloseReason.TaskManagerClosing > >> > >> End Sub > >> > >> > >> > >> regards > >> > >> > >> > >> Michel Posseth [MCP] > >> > >> > >> > >> "Strah" <St***@discussions.microsoft.com> schreef in bericht > >> news:9509273D-2031-40B3-A731-E2F6417DCE50@microsoft.com... > >> > Is there a way to catch the event of terminating the application from > >> > the > >> > the > >> > processes tab in task manager? > >> > > >> > I have created windows app, and if a user termintates the app in the > >> > task > >> > manager, I'd like to be notified. I tried few combinations of Close, > >> > Closing, > >> > Application.Exit method, ApplicationExit Event, etc, but nothing seems > >> > to > >> > be > >> > working. > >> > > >> > Thanks in advance > >> > Strah@Langan > >> > >> > >> > > > |
|||||||||||||||||||||||