다음을 통해 공유


IDebugThread2::GetThreadProperties

이 스레드를 설명하는 속성을 가져옵니다.

구문

int GetThreadProperties (
    enum_THREADPROPERTY_FIELDS dwFields,
    THREADPROPERTIES[]         ptp
);

매개 변수

dwFields
[in] 채워질 ptp 필드를 결정하는 THREADPROPERTY_FIELDS 열거형의 플래그 조합입니다.

ptp
[in, out] 스레드의 속성으로 채워지는 THREADPROPERTIES 구조체입니다.

Return Value

성공하면 S_OK를 반환하고, 실패하면 오류 코드를 반환합니다.

설명

이 메서드에서 반환된 정보는 일반적으로 스레드 디버그 창에 표시됩니다.

예시

다음 예는 IDebugThread2 인터페이스를 구현하는 간단한 CProgram 개체에 대해 이 메서드를 구현하는 방법을 보여 줍니다.

HRESULT CProgram::GetThreadProperties(THREADPROPERTY_FIELDS dwFields,
                                      THREADPROPERTIES *ptp)
{
    HRESULT hr = E_FAIL;

    // Check for valid argument.
    if (ptp)
    {
        // Create an array of buffers at ptp the size of the
        // THREADPROPERTIES structure and set all of the
        // buffers at ptp to 0.
        memset(ptp, 0, sizeof (THREADPROPERTIES));

        // Check if there is a valid THREADPROPERTY_FIELDS and the TPF_ID flag is set.
        if (dwFields & TPF_ID)
        {
            // Check for successful assignment of the current thread ID to
            // the dwThreadId of the passed THREADPROPERTIES.
            if (GetThreadId(&(ptp->dwThreadId)) == S_OK)
            {
                // Set the TPF_ID flag in the THREADPROPERTY_FIELDS enumerator
                // of the passed THREADPROPERTIES.
                ptp->dwFields |= TPF_ID;
            }
        }

        hr = S_OK;
    }
    else
        hr = E_INVALIDARG;

    return hr;
}

참고 항목