473,385 Members | 1,341 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

detect "task manager end process"

Hi guys!

Im trying to detect when a user "kills" my c# app using windows task
manager, i've tried with the form events _closing and _closed managing
for example putting an if inside to detect it:

if (e.CloseReason == CloseReason.TaskManagerClosing)
{
MessageBox.Show("from task manager");
}

but it doesn´t works, any idea?

Regards
Ricc
Oct 10 '07 #1
4 13235
Hello e-Ricc,

u need to inject dll into the taskmanager, hooking the TerminateProcess in
Kernel32
and such u can add your custom code

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
eHi guys!
e>
eIm trying to detect when a user "kills" my c# app using windows task
emanager, i've tried with the form events _closing and _closed
emanaging for example putting an if inside to detect it:
e>
eif (e.CloseReason == CloseReason.TaskManagerClosing)
e{
eMessageBox.Show("from task manager");
e}
ebut it doesn?t works, any idea?
e>
eRegards
eRicc
Oct 11 '07 #2
"e-Ricc" <rk****@hotmail.comwrote in message
news:ew**************@TK2MSFTNGP04.phx.gbl...
Hi guys!

Im trying to detect when a user "kills" my c# app using windows task
manager, i've tried with the form events _closing and _closed managing for
example putting an if inside to detect it:

if (e.CloseReason == CloseReason.TaskManagerClosing)
{
MessageBox.Show("from task manager");
}

but it doesn´t works, any idea?

Regards
Ricc


This event (TaskManagerClosing) is raised when the "Task" is terminated, not
when the "Process" is terminated, the latter stops the process cold, no
events are raised, so there is nothing you can do from within the
application itself.
One solution for this is to Remove Taskman from the taskbar using Group
Policy Management (Local Computer Policy), sure this isn't of any help if
the user has other means to kill a running process.

To watch process termination events, you can run a watchdog (needs
administrative privileges!) which listens for WMI "Win32_ProcessStopTrace"
events using System.Management 's ManagementEventWatcher.

Willy.

Oct 11 '07 #3

<Michael Nemtsev>; "MVP" <ne*****@msn.comwrote in message
news:3d**************************@msnews.microsoft .com...
Hello e-Ricc,

u need to inject dll into the taskmanager, hooking the TerminateProcess in
Kernel32
and such u can add your custom code
Would work I suspect, but no user would ever voluntarily use software that
does such a thing.
>
---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

eHi guys!
eeIm trying to detect when a user "kills" my c# app using windows task
emanager, i've tried with the form events _closing and _closed
emanaging for example putting an if inside to detect it:
eeif (e.CloseReason == CloseReason.TaskManagerClosing)
e{
eMessageBox.Show("from task manager");
e}
ebut it doesn?t works, any idea?
eeRegards
eRicc


Oct 15 '07 #4

Oki doki!

let me look for info, thanks!!

Regards
e-Ricc
Ben Voigt [C++ MVP] wrote:
<Michael Nemtsev>; "MVP" <ne*****@msn.comwrote in message
news:3d**************************@msnews.microsoft .com...
>Hello e-Ricc,

u need to inject dll into the taskmanager, hooking the TerminateProcess in
Kernel32
and such u can add your custom code

Would work I suspect, but no user would ever voluntarily use software that
does such a thing.
>---
WBR, Michael Nemtsev [.NET/C# MVP] :: blog:
http://spaces.live.com/laflour
"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo

eHi guys!
eeIm trying to detect when a user "kills" my c# app using windows task
emanager, i've tried with the form events _closing and _closed
emanaging for example putting an if inside to detect it:
eeif (e.CloseReason == CloseReason.TaskManagerClosing)
e{
eMessageBox.Show("from task manager");
e}
ebut it doesn?t works, any idea?
eeRegards
eRicc


Oct 15 '07 #5

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

Similar topics

2
by: John E. Hadstate | last post by:
Please forgive the heavy cross-posting and feel free to delete inappropriate groups when you reply. I am really at a loss and hope someone has an answer for my problems. Environment: Redhat...
1
by: Tom | last post by:
I've forgotten how to add a particular line to the task list in vs2003 before there was a context menu that you can click on to add something to task and come back to later.. but now I can't find...
2
by: Julio Allegue | last post by:
I am getting the wrong Count(*) on vb.net using the ExecuteScalar . It returns all the rows. It doesn't seem to look at the WHERE clause. At the same time, I am getting the correct count on "SQL...
4
by: Leeor Chernov | last post by:
Hi , I Used the object Excell Application(COM INTEROP) and it is staying as an open process, And the owner(User Name) is ASPNET Altough I try to release it with :...
0
by: AJ2 | last post by:
Hi Guys, I included "for xml auto" in sql statement in "Excute SQL Task" and aimed to dump the output to a flat file. I added "ActiveX Script Task" into my package and with the following lines: ...
8
by: Henrik | last post by:
Hi Is there any way to see what the System process is doing? We have developed an application running at a production site to measure and optimize the production. The application needs to be...
1
by: Brad Pears | last post by:
I am working on a vb .net 2005 project. Recently I wanted to changed the location of my builds from debug to release. I clicked on the 'Build option and for some unknown reason, the "configuration...
4
by: AliRezaGoogle | last post by:
Dear Members I have a critical program written in c#. It runs every time the user log on. But sometimes log-oned user forces my application process to quit by “End Process” in task manager. How...
4
by: tvnaidu | last post by:
How can I cheack CPU load on LINUX like "Windows Task manager" on Windows?. Windows task manager shows CPU load (percentage) and etc, any tool in LINux?. I know "top" command which shows which...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.