2015-02-25 3 views
0

Я создаю приложение на основе wec7. У меня есть следующая нить:Поиск темы с использованием TID

bool ChannelDataQueue::b_ChannelDataQueue_StartThread() 
{ 
    m_hThread = CreateThread(NULL, 0, ChannelDataQueue::u32_ChannelDataQueue_ReadChannelData, (LPVOID)this, CREATE_SUSPENDED, NULL); 

    CeSetThreadPriority(m_hThread,CE_THREAD_PRIO_256_HIGHEST); 
    //SetThreadPriority(m_hThread,249);//248 
    ResumeThread(m_hThread); 

    return true; 
} 

Я использую дистанционные инструменты в VS2008 для мониторинга процессов и потоков, но нити появляются только с процессом они находятся и TID/PID. Я не знаю, как определить, какой поток я контролирую на основе его идентификатора.

ответ

0

Последний параметр для вызова CreateThread является указателем на DWORD, который получит идентификатор потока.

Пример:

bool ChannelDataQueue::b_ChannelDataQueue_StartThread() 
{ 
    DWORD threadID; 

    m_hThread = CreateThread(NULL, 0, ChannelDataQueue::u32_ChannelDataQueue_ReadChannelData, (LPVOID)this, CREATE_SUSPENDED, &threadID); 

    // At this point, inspect the threadID in the debugger, 
    // print it to the console, write it to a file, etc... 

    CeSetThreadPriority(m_hThread,CE_THREAD_PRIO_256_HIGHEST); 
    //SetThreadPriority(m_hThread,249);//248 
    ResumeThread(m_hThread); 

    return true; 
}