TerminateProcess() is easier, but doesn't unload the dll's from memory, which means it doesn't let the dll's know the process is terminated, and leaves them floating around in memory, lost, causing problems. It should only be used in worst-case situations. system(), WinExec(), ShellExecute(), and ShellExecueEx(), are easier, but you don't get as much information about the process being started. Since CreateProcess() is very powerful, and seems rather intimidating at first you can see codeproject example: http://www.codeproject.com/cpp/kill_process.asp
我是先发送WM_CLOSE然后等待其结束,等待5秒后再强行结束的.
you can see codeproject example:
http://www.codeproject.com/cpp/kill_process.asp
TerminateProcess太暴力了
可能有些资源没有清除