Debugging Tools for Windows

SetCurrentThreadId

The SetCurrentThreadId method makes the specified thread the current thread.

HRESULT
  IDebugSystemObjects::SetCurrentThreadId(
    IN ULONG  Id
    );

Parameters

Id
Specifies the engine thread ID of the thread that is to become the current thread.

Return Value

S_OK
The method was successful.
E_NOINTERFACE
No thread with the specified ID was found.

This method may also return other error values. See Return Values for more details.

Interface Version

SetCurrentThreadId is available in all versions of IDebugSystemObjects.

Comments

This method may also change the current process, current target, and current computer.

If the thread is changed, the callback IDebugEventCallbacks::ChangeEngineState will be called with the DEBUG_CES_CURRENT_THREAD bit set.

Note  In kernel-mode debugging, the current thread is a virtual thread, it is not a system thread. This method cannot be used to change between system threads in kernel-mode debugging. However, the implicit thread may be changed by using SetImplicitThreadDataOffset.

For more information about threads, see Threads and Processes. For details on monitoring events, see Monitoring Events.

Requirements

Headers: Defined in Dbgeng.h. Include Dbgeng.h.

Build machine: CAPEBUILD