Win32 API analog of sending/catching SIGTERM

前端 未结 3 1884
Happy的楠姐
Happy的楠姐 2020-12-03 14:48

Under POSIX OS there is signal API that allows to send a signal to process to shut it down with kill and you can catch it with sigaction and do what you need;

Howeve

3条回答
  •  Happy的楠姐
    2020-12-03 15:16

    May be Windows Power Management from MSDN would be helpful. But it deals with system events rather than per process.

    For a process, you would be able to detect termination with WM_CLOSE. You would need to handle windows messages. If it's a console application you would need to install a control handler; take a look at SetConsoleCtrlHandler on MSDN

提交回复
热议问题