Handling end process of a windows app

后端 未结 6 1801
無奈伤痛
無奈伤痛 2020-12-01 06:49

Is it possible to capture the task manager end process of a windows application within the same windows application itself? I am using a C# 2.0 win app and I would like to d

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-01 07:31

    I do not think this is possible to do from within the application. The purpose of End Task is to immediately stop the process. This does not allow any clean up code to execute.

    Shoban pointed out another way to accomplish your goal. Another application or service would need to look for the main process. When the other process cannot find the main process, you could do the database processing at that point.

提交回复
热议问题