這裏是我的代碼,其中包含錯誤:如何在同一個類(C++,MFC)中調用工作線程?
void ClassA::init()
{
HANDLE hThread;
data thread; // "thread" is an object of struct data
hThread = CreateThread(NULL, 0, C1::threadfn, &thread, 0, NULL);
}
DWORD WINAPI ClassA::threadfn(LPVOID lpParam)
{
data *lpData = (data*)lpParam;
}
錯誤:
error C3867: 'ClassA::threadfn': function call missing argument list; use '&ClassA::threadfn' to create a pointer to member
是什麼力量讓工作線程在一個類工作的正確方法?
你能解決拼寫錯誤嗎? C1 :: threadfn不會導致ClassA :: thradfn'錯誤。 – harper 2011-01-13 15:21:12