which function gets called in case of End Task for process running in Background
-
Hi there, I have my Tray application running as Background process in Win8 When I click for End task from Task Manager, how to get notified for End Task call. (which function is called??) (In case of GUI application WM_CLOSE gets called but I couldn't able to trace for this.) -Thanks
-
Hi there, I have my Tray application running as Background process in Win8 When I click for End task from Task Manager, how to get notified for End Task call. (which function is called??) (In case of GUI application WM_CLOSE gets called but I couldn't able to trace for this.) -Thanks
Raymond Chen has the answer:
Why can't you trap TerminateProcess?[^]
If a user fires up Task Manager and clicks "End Task" on your program, Windows first tries to shut down your program nicely, by sending
WM_CLOSE
messages to GUI programs andCTRL_CLOSE_EVENT
events to console programs. But you don't get a chance to interceptTerminateProcess
.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Hi there, I have my Tray application running as Background process in Win8 When I click for End task from Task Manager, how to get notified for End Task call. (which function is called??) (In case of GUI application WM_CLOSE gets called but I couldn't able to trace for this.) -Thanks
It can be one of three applications; A windows service; in that case, it would have an event that is raised. Should not show a UI. A console application; would not show a tray icon A windows GUI application; regardless of whether you show a form, it still is a GUI application. Keep a form open (something I'd expect from the Application.Run(formName) call) and make it invisible.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)