gpt4 book ai didi

c++ - 在 C/C++ 窗口中终止进程

转载 作者:可可西里 更新时间:2023-11-01 09:48:57 28 4
gpt4 key购买 nike

我正在尝试捕捉进程结束的时间(例如,通过在任务管理器中将其终止)。为了当它检测到(在结束的过程中)时,在退出做一些工作之前。我的应用并没有自己结束(死循环)

我试过:1) atexit 2) SetUnhandledExceptionFilter

我尝试在调试运行中简单地关闭正在运行的应用程序,但最终没有达到执行额外任务的地步。

帮助,

最佳答案

这应该可以回答您的问题:

There are two ways to kill application in Task Manager.

Killing through Applications tab would roughly be equivalent of SIGTERM(in Linux). Application may intercept it and do more processing, since it's basically sending a "close window" message. Message to catch is WM_CLOSE.

Killing through Processes tab would roughly be equivalent of SIGKILL(in Linux). There is nothing you can do to intercept that, short of monitoring user's actions in Task Manager's listbox and End Process button, or having a watchdog process that will see when the first one is killed

关于c++ - 在 C/C++ 窗口中终止进程,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7994375/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com