用进程管理器Kill进程时,有没有执行WM_DESTROY消息?解决方法

用进程管理器Kill进程时,有没有执行WM_DESTROY消息?

void   CClocktimeDlg::OnDestroy()  
{
KillTimer(1);
TaskBarDeleteIcon(GetSafeHwnd(),100);       //删除任务栏的图标  
CDialog::OnDestroy();

//   TODO:   Add   your   message   handler   code   here

}


------解决方案--------------------
没有,进程直接被干掉,一点喘息的机会都没有。
------解决方案--------------------
没有,这种方式关闭进程,进程自己都不知道,也无法知道,是其它进程来关闭它的。
------解决方案--------------------
BOOL TerminateProcess
(
HANDLE hProcess, // handle to the process
UINT uExitCode // exit code for the process
);

Remarks
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances. The state of global data maintained by dynamic-link libraries (DLLs) may be compromised if TerminateProcess is used rather than ExitProcess.


就是说千万不要轻易用这个函数去退出一个进程。很有可能资源会泄露。因为是强行关闭的,资源什么的都没有释放。

TaskManager就是用的这个函数来的。
------解决方案--------------------
因为是强行关闭的,资源什么的都没有释放。
===================================================
不是非常正确,进程表中维护的资源都会被释放,但是有些东西没有被释放,比如打开的内核对象