如题

解决方案 »

  1.   

    MSDN帮助如下:
    TerminateProcess
    The TerminateProcess function terminates the specified process and all of its threads. BOOL TerminateProcess(
      HANDLE hProcess, // handle to the process
      UINT uExitCode   // exit code for the process
    );
    Parameters
    hProcess 
    [in] Handle to the process to terminate. 
    Windows NT/2000/XP: The handle must have PROCESS_TERMINATE access. For more information, see Process Security and Access Rights. uExitCode 
    [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. 
    Return Values
    If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError. 
      

  2.   

    我就是问uExitCode 具体是什么 不同的有什么区别
      

  3.   

    var
      hProc: THandle;
      hProcessID: Cardinal;
    begin
      hProcessID := winexec('Your program',SW_SHOWNORMAL );   
      hProc := OpenProcess(PROCESS_ALL_ACCESS or PROCESS_TERMINATE, FALSE, LongInt(hProcessID));
      Terminateprocess(hProc, 0)