How to deny the access to user from killing MFC dialog based application from
Task Manager (Terminate process) or atleast get notified when it is killed
You can mail to [email protected]
Printable View
How to deny the access to user from killing MFC dialog based application from
Task Manager (Terminate process) or atleast get notified when it is killed
You can mail to [email protected]
Strange.... are you trying to develop something that prevents the owner of the machine/program from decide what should be running or not? Really weird indeed. I think that can't be done, anyway, have you seen it somewhere ?
Regarding "get notified when killed", i think Windows has a funny way to KILL processes. It just removes the thread without first sending KILL message to clean things nicely. So i guess you don't have a chance here either...
--
Nuno Tavares
http://nthq.cjb.net
I forgot to mentio that if it is a service, and it's installed by Administrator Priviledged User (WinNT only) it won't be killed by a common user.
--
Nuno Tavares
http://nthq.cjb.net
I don't know if it works, but it might be a solution (maybe).
You have to make 2 applications:
-the first one(app1) has to do the following -launch the other application(app2)
-wait to finish (app2) and check a value returned by app2 (ex. if it is true app2 terminated normaly and if it is false app2 was killed)
An example of application who can launch another process and wait for it to finish you can find at codeguru.com but I don't remember the exact place.
The sad part is if the user kill app1.In this case I really don't know what to do.
Sorry for my bad english.
Ciprian Pavel.
Sincerily
Ciprian Pavel
I don't know if it works, but it might be a solution (maybe).
You have to make 2 applications:
-the first one(app1) has to do the following -launch the other application(app2)
-wait to finish (app2) and check a value returned by app2 (ex. if it is true app2 terminated normaly and if it is false app2 was killed)
An example of application who can launch another process and wait for it to finish you can find at codeguru.com but I don't remember the exact place.
The sad part is if the user kill app1.In this case I really don't know what to do.
Sorry for my bad english.
Sincerily
Ciprian Pavel
I think that getting "notified when it is killed" is an excellent solution. You can process the WM_CLOSE message, because the first thing that the task manager does is to send it, and I have verified that a dialog gets the message and can process the message. Hopefully in your WM_CLOSE message you will be able to do whatever cleanup is required. This is definitely the way it "should" be done. Note that you must get all the data you need to get from the dialog before calling CDialog::OnClose().
When applicaton is killed through Task Manager process tab using End Process option, application will not get any wm_close message. thats the problem i had? please if u have any other solution let me know [email protected]
I tested it and my dialog definitely got the close message. It works. However, I used the "End Process" on the "Applications" tab. That is what should be used when possible. The "Processes" tab should be used when the "Applications" tab cannot be used. When I used the "Processes" tab to terminate my dialog, the dialog did not get a close message.