不可能关闭所有的进程的,有的进程是关闭不了的,<br>然后有的进程如果关闭,windows是无法响音的。<br>呵呵.<br><br>TerminateProcess<br>The TerminateProcess function terminates the specified process and all of its threads. <br><br>BOOL TerminateProcess(<br> HANDLE hProcess, // handle to the process<br> UINT uExitCode // exit code for the process<br>);<br>Parameters<br>hProcess <br>[in] Handle to the process to terminate. <br>Windows NT/2000/XP: The handle must have PROCESS_TERMINATE access. For more information, see Process Security and Access Rights. <br><br>uExitCode <br>[in] Specifies the exit code for the process and for all threads terminated as a result of this call. Use the GetExitCodeProcess function to retrieve the process's exit value. Use the GetExitCodeThread function to retrieve a thread's exit value. <br>Return Values<br>If the function succeeds, the return value is nonzero.<br><br>If the function fails, the return value is zero. To get extended error information, call GetLastError. <br><br>Remarks<br>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. <br><br>TerminateProcess causes all threads within a process to terminate, and causes a process to exit, but DLLs attached to the process are not notified that the process is terminating. <br><br>Terminating a process causes the following: <br><br>All of the object handles opened by the process are closed. <br>All of the threads in the process terminate their execution. <br>The state of the process object becomes signaled, satisfying any threads that had been waiting for the process to terminate. <br>The states of all threads of the process become signaled, satisfying any threads that had been waiting for the threads to terminate. <br>The termination status of the process changes from STILL_ACTIVE to the exit value of the process. <br>Terminating a process does not cause child processes to be terminated. <br><br>Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed. <br><br>Terminating a process does not generate notifications for WH_CBT hook procedures. <br><br>Requirements <br> Windows NT/2000/XP: Included in Windows NT 3.1 and later.<br> Windows 95/98/Me: Included in Windows 95 and later.<br> Header: Declared in Winbase.h; include Windows.h.<br> Library: Use Kernel32.lib.<br><br>See Also<br>Processes and Threads Overview, Process and Thread Functions, ExitProcess, OpenProcess, GetExitCodeProcess, GetExitCodeThread <br><br><br>