创建线程出错

zhaolixin007 zhaolixin007 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
问题现象:
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.

请有相应经验的兄弟解决下这个问题,谢谢。



...全文

相关推荐

评论 9
收藏 已收藏
分享
返回顶部
zhaolixin007
进程/线程/DLL 15,466 成员 49,169 内容