AfxGetThread
呼叫這個函式的指標表示目前正在執行之執行緒的 CWinThread 物件。
CWinThread* AfxGetThread( );
傳回值
目前執行之執行緒的指標;否則為 NULL。
備註
必須從所需的執行緒內呼叫。
![]() |
---|
如果從 Visual C++ 4.2、5.0 或 6.0版移植 MFC 專案呼叫 AfxGetThread , 則如果找不到任何執行緒,AfxGetThread 會呼叫 AfxGetApp 。在視覺化 C+ .NET (含) 以後版本中, 如果找不到任何執行緒AfxGetThread 會傳回 NULL 。如果您希望應用程式執行緒,您必須呼叫 AfxGetApp。 |
範例
//Print the current thread ID in the Debug Window
TRACE(_T("Current Thread ID = 0x%X\n"), AfxGetThread()->m_nThreadID);
需求
標題: afxwin.h