IDebugThread2::GetThreadProperties

Gets the properties that describe this thread.

Syntax

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

Parameters

dwFields
[in] A combination of flags from the THREADPROPERTY_FIELDS enumeration that determines which fields of ptp are to be filled in.

ptp
[in, out] A THREADPROPERTIES structure that is filled in with the properties of the thread.

Return Value

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

Remarks

The information returned from this method is typically shown in the Threads debug window.

Example

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

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;
}

See also