Compartir a través de


IDebugThread2::GetThreadId

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Gets the system thread identifier.

Syntax

HRESULT GetThreadId (
    DWORD* pdwThreadId
);
int GetThreadId (
    out uint pdwThreadId
);

Parameters

pdwThreadId
[out] Returns the system thread identifier.

Return Value

If successful, returns S_OK; otherwise, returns an error code.

Remarks

A thread ID is used to identify a thread among all other threads in a process.

Example

The following example shows how to implement this method for a simple CProgram object that implements the IDebugThread2 interface.

HRESULT CProgram::GetThreadId(DWORD* pdwThreadId) {
    *pdwThreadId = GetCurrentThreadId();
    return NOERROR;
}

See also