Using the TerminateThread
function.
The function you posted does:
PostThreadMessage(hookThreadId, WM_QUIT, (WPARAM) NULL, (LPARAM) NULL);
WaitForSingleObject(hookThreadHandle, 5000);
So it sends a quit message to that thread, and then waits for it to close.
6
solved stopping a thread in windows [closed]