472,353 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

catch the process terminate from the task manager

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
May 25 '06 #1
4 15511

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:95**********************************@microsof t.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

May 25 '06 #2
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:95**********************************@microsof t.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


May 25 '06 #3
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:E6**********************************@microsof t.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:95**********************************@microsof t.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


May 25 '06 #4
hmm it seems I need to create a service to guard my application... a bit
disappointing, but thanks for your input
"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:E6**********************************@microsof t.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:95**********************************@microsof t.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


May 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: san | last post by:
Hi, I have a C# windows application App.exe that uses a UI component from another dll that components.dll. Everything works fine except that...
3
by: Pankaj | last post by:
Hi All: Is there a solution to below problem...without....restarting VS.Net 2003 so may be sometimes restarting PC. // Cannot copy assembly...
5
by: GTS | last post by:
Hi All, I am spawning a process from a service. The spawned process hungs for various reasons, (corrupted data, deadlock). I am expecting the...
3
by: sandro72 | last post by:
I found the classes you wrote of but it doesn't work. i tested also this code but it cretaes instances of worpad.exe that i only see by task...
5
by: jimocz | last post by:
Hi all, I am new to .NET so this problem may not be a problem to this groups readers. I am learning .NET and I have built programs and lauched...
2
by: CodeSlayer | last post by:
Hi all, This one really has me and the other .Net developers at my work stumped. I have an application that is doing the following: 1 -...
1
by: LBT | last post by:
Hi experts, Sometimes there is some "unkilled" processes remained in Task Manager. For instance, there is a task to generate picture using ASP...
9
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
3
by: Chris | last post by:
I have a python script that is driving Excel and using the win32com module. However, upon program completion there's still an Excel.exe process...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.