Click here to Skip to main content
15,867,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Afternoon,

i am developing a 'Formless' application that will run in the background and run on logon under the current user which is all working fine as expected.

However, i require the program to run in the background as it is a monitoring task that shouldnt be closed under any circustances other than Logging off / Shutting down etc.

I know in a windows form application you can handle the 'Form Closing' event and cancel it but this doesnt work using end process. i want to be able to prevent the user from clicking 'End Process' such as an 'Access Denied' message etc

This wouldnt be a problem if i could run it as system but it specifically needs to run as the user.

Any thoughts and direction would be greatly appreciated.

Dev.
Posted
Comments
Richard Deeming 22-Apr-15 9:41am    
Programs which can't be killed are usually associated with malware. Why should the user not be able to control what runs on their computer?
Dev O'Connor 22-Apr-15 9:57am    
This is an internal program (in a domain for employee monitoring) not for public release so the users should have access to terminate certain programs.
Richard Deeming 22-Apr-15 9:58am    
Would a Windows Service work? Only local administrators should be able to stop a service.
Dev O'Connor 22-Apr-15 10:30am    
I was contemplating it however i would need the application to run as the logged in user not as system which is why i havent explorered this avenue as the computers are hot desk so the same user may not be sat at the same desk day in day out.

1 solution

One idea:

You must create two processes that watch each other.
When one process detects that its counterpart is not running any more
the it should start it again.

But there is still a way to kill these processes by using SysInternals Process Explorer.
You suspend one of the two processes so that it cannot watch any more its counterpart
an then you can kill them both.
 
Share this answer
 
Comments
Dev O'Connor 22-Apr-15 9:03am    
Thanks, i thought that would be the case but i thought i would check first.

Fortunately i have managed to identify something in our AntiVirus rules in the company, which is to prevent termination of certain processes. Going to try this but if this doesnt work i will revert back to creating two processes.

Thanks very much.
TheRealSteveJudge 22-Apr-15 9:08am    
You're welcome!
Richard Deeming 22-Apr-15 9:40am    
This is an approach commonly used by malware. If I saw a program doing that, it would get deleted PDQ!
Dev O'Connor 22-Apr-15 9:42am    
Normally me too however i need to be able to create a program that cannot be stopped or at least restarted instantly.
TheRealSteveJudge 22-Apr-15 9:57am    
You are right.
But it is like a knife.
You can use it for cutting bread or for doing harmful things.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900