创建线程出错
问题现象:
1:使用AfxBeginThread函数:
使用如下语句:
HANDLE hmulti;
hmulti = AfxBeginThread(ThreadProc1,0,0,0,NULL);
我的线程响应函数如下:
UINT ThreadProc1()
{
return 0;
}
编译过程中出现:
error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void)' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
问题
2: 使用CreateThread
使用如下语句:
HANDLE hmulti;
hmulti =CreateThread(NULL,0,ThreadProc1,this,0,NULL);
我的线程响应函数如下:
UINT ThreadProc1()
{
return 0;
}
编译过程中出现:
error C2664: 'CreateThread' : cannot convert parameter 3 from 'unsigned long (void)' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type
Error executing cl.exe.
请有相应经验的兄弟解决下这个问题,谢谢。