用ExitThread,希望下面的帮助对你有帮助Unit
Windows.PasSyntax
ExitThread(
dwExitCode: DWORD {exit code for the thread}
); {this procedure does not return a value}Description
This procedure will end a thread and clean up any associated DLLs. If this is the last thread of the process, the process will also end. Any threads that have been waiting for the thread in question to terminate will be released, and the thread in question will become signaled.
A successful call to this procedure causes the following:
1. All object handles opened by the thread are closed.
2. All threads in the started by the thread terminate.
3. The state of the thread becomes signaled, satisfying any threads that have been waiting for the thread.
4. The states of all threads within the thread become signaled, satisfying any threads that have been waiting for the threads.
5. The termination status is changed from STILL_ACTIVE to the exit code specified by the uExitCode parameter.Parameters
dwExitCode: Specifies the exit code for the process, and for all threads that are terminated as a result of this call. Use the GetExitCodeThread function to retrieve this value.