IDebugThread2:: GetThreadProperties

获取描述此线程的属性。

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

参数

返回值

如果成功,则返回; S_OK否则,返回错误代码。

备注

从此方法返回的信息。 线程 通常显示调试窗口。

示例

下面的示例演示如何执行简单的 CProgram 对象的方法实现 IDebugThread2 接口。

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

请参见

参考

IDebugThread2

THREADPROPERTY_FIELDS

THREADPROPERTIES