我创建线程时使用了这个函数:CreateThread(NULL,0,ThreadFunc,NULL,0,NULL);void CTestDlg::ts()
{
AfxMessageBox("成功创建了线程!");
}可是它总是提示我说:
C:\test\testDlg.cpp(104) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'void (void)' to 'unsigned long (__stdcall *)(void *)'
这是为何?
{
AfxMessageBox("成功创建了线程!");
}可是它总是提示我说:
C:\test\testDlg.cpp(104) : error C2664: 'CreateThread' : cannot convert parameter 3 from 'void (void)' to 'unsigned long (__stdcall *)(void *)'
这是为何?
LPVOID lpParameter // thread data
);
DWORD WINAPI ThreadProc(LPVOID lpParameter // thread data);CreateThread(NULL,0,ThreadFunc,NULL,0,NULL);
DWORD WINAPI ThreadProc(LPVOID lpParameter // thread data );
{
....//功能....
}也就是在CreateThread(NULL,0,ThreadFunc,NULL,0,NULL)之前需要有
DWORD WINAPI ThreadProc(LPVOID lpParameter)线程函数的申明!