473,581 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Exi t method, ApplicationExit Event, etc, but nothing seems to be
working.

Thanks in advance
Strah@Langan
May 25 '06 #1
4 15918

well you should be able to catch this in the form`s closing event

Private Sub Form1_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

e.CloseReason.T askManagerClosi ng

End Sub

regards

Michel Posseth [MCP]

"Strah" <St***@discussi ons.microsoft.c om> schreef in bericht
news:95******** *************** ***********@mic rosoft.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.Exi t 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.T askManagerClosi ng, 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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

e.CloseReason.T askManagerClosi ng

End Sub

regards

Michel Posseth [MCP]

"Strah" <St***@discussi ons.microsoft.c om> schreef in bericht
news:95******** *************** ***********@mic rosoft.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.Exi t 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***@discussi ons.microsoft.c om> schreef in bericht
news:E6******** *************** ***********@mic rosoft.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.T askManagerClosi ng, 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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

e.CloseReason.T askManagerClosi ng

End Sub

regards

Michel Posseth [MCP]

"Strah" <St***@discussi ons.microsoft.c om> schreef in bericht
news:95******** *************** ***********@mic rosoft.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.Exi t 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***@discussi ons.microsoft.c om> schreef in bericht
news:E6******** *************** ***********@mic rosoft.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.T askManagerClosi ng, 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_FormClosi ng(ByVal sender As Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles Me.FormClosing

e.CloseReason.T askManagerClosi ng

End Sub

regards

Michel Posseth [MCP]

"Strah" <St***@discussi ons.microsoft.c om> schreef in bericht
news:95******** *************** ***********@mic rosoft.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.Exi t 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
6365
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 when I close the window of App.exe the process does not terminate (I can see App.exe is the task manager). Also, I tried to see if control was returned to Main() after closing the UI (since...
3
5172
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 'MyClient.Client' to file 'C:\bin\Debug\MyClient.Client.dll'. The process cannot access the file because it is being used by another process. -Pankaj
5
3079
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 process has to complete the task with in the expected time limit, if it exceeds the limit I want to terminate the process (no mercy or graceful, just terminate the process). The spawnng of the...
3
5618
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 manager and i cannot terminate them. have you any ideas? Dim pr As New System.Diagnostics.Process pr.StartInfo.WindowStyle = Diagnostics.ProcessWindowStyle.Normal
5
1503
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 them within the IDE. Occassionally my program's process won't end with the program completing (by using the window's X button). In fact I cannot manually terminate the process with the Task Manager....
2
1913
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 - attempt to validate that user can create a windows task via COM interops 2 - an exception is thrown because user doesn't exist 3 - Exception is caught by calling code shown below:
1
2644
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 image scheduled by SQL job but somehow certain processes like cmd.exe and IExplorer.exe are not released and cause the SQL job non-stop running. Even with kill job signal being sent to SQL but the...
9
16093
by: SeC | last post by:
Hi. Is there any way to detect if application is being killed by 'End Process' via Task Manager ?
3
4879
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 running in the background that I must terminate through Task Manager. Reading up on other threads indicate that maybe I still have some Excel objects referenced within my code. Is this why the process...
0
7868
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7792
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8304
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8175
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5364
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3805
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.