How does Task Scheduler end up?

I am interested to know how the task scheduler completes the task. I have added the application to the tasks Task Scheduler, and it seems that when you click Task Scheduler in the end for my work (after the launch of the task scheduler), the task is killed by windows (does not receive WM_QUITor WM_CLOSEmessages in my application). I also did not find a way to configure how I want my task to be closed in Task Scheduler. My goal is to process the message sent by the task scheduler (if any) and close my application.

+5
source share
1 answer

The process is probably killed using the Windows function TerminateProcess(). The message queue has nothing to do with this. There is no way to configure this, and there is no way to capture a TerminateProcess.

If you need to work for long periods of time, consider creating a real Windows service instead of using a task scheduler. You will then receive Service Management Notifications, including disconnection notifications that will allow you to clear before your service is released.

+2
source

All Articles