>>my program brings the same list of processes with the same process id as NT. but the terminateprocess function i use doens't terminate them.
>>i would like to know how NT does this operation ?
>
>How are you using it? See Message#
496824 for an example.
TerminateProcess() will definitely shut down a process if it can be killed at all, however, it's almost always preferable to send a WM_CLOSE to the thread's message queue using SendMessage() to send it to the hWnd of the primary Window for the process or PostThreadMessage() to send it to the main thread handle and give it a chance to do an orderly shutdown rather than using TerminateProcess() indiscriminantly, since while it kills the process space, it doesn't release shared DLL or COM resources properly, nor does it release remoted file handles when it quits - it depends on the remote server determining that the client has ceased to be.