On Windows 95, Windows 98, and Windows NT, there is no way to obtain the thread handle from the thread ID. On these operating systems, a thread handle can be shared with another process by using the DuplicateHandle() function.
On Windows Millennium Edition, Windows 2000, and Windows XP, the OpenThread() function can be used to obtain a thread handle based on the thread ID.
The APIs that take a thread handle can be used to suspend and resume a thread, adjust the priority of a thread, read and write a thread's registers, limit a thread to a set of processors, terminate a thread, and other actions. Performing any one of these operations on a thread without the knowledge of the owning process is dangerous, and may cause the process to fail.
NOTE: On all Win32 operating systems, you can also take full control of the application by calling DebugActiveProcess(). Debuggers receive the thread handles for a process when the threads are created. These handles have THREAD_GET_CONTEXT, THREAD_SET_CONTEXT, and THREAD_SUSPEND_RESUME access to the thread.
ID članka: 127992 – Zadnji pregled: 21. nov. 2006 – Revizija: 1