创建线程出错
问题现象:
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.
请有相应经验的兄弟解决下这个问题,谢谢。
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个线程同时操作全局变量的出错结果,并采用自动验证结果,直到程序出错,有很好的演示和学习价值。
vb通过com使用多线程
vb使用CreateThread使用多线程时,很容易出错,找规律好像是创建的线程执行工程内代码时引起的,为了避免这种状况的出现,把线程代码都放在com内运行,再用vc写个dll创建线程,在里面调用这个com。这是真的多线程,不像用ActiveX exe,那是多进程
C#解决“创建窗口句柄时出错”异常
解决“创建窗口句柄时出错”异常,具体问题分析在“说明.txt”文件中
线程池原理及创建 C++ 实现
本文给出了一个通用的线程池框架,该框架将与线程执行相关的任务进行了高层次的抽象,使之与具体的执行任务无关。另外该线程池具有动态伸缩性,它能根据执行任务的轻重自动调整线程池中线程的数量。文章的最后,我们给出部分实现。


进程/线程/DLL
