我自定义一个类MyClass,想在类创建线程,
在头文件声明:
public:
DWORD WINAPI ReadThreadProc(LPVOID lpvoid);//线程函数
VOID StartThread();//创建线程函数
在cpp文件我定义:
DWORD WINAPI MyClass::ReadThreadProc(LPVOID lpvoid)
{
..........
}
VOID MyClass::StartThread()
{
hThread = CreateThread(
NULL,
0, (LPTHREAD_START_ROUTINE)ReadThreadProc,
(LPVOID) &threadParam,
0,
&dwReadStatId);
......
}可是编译的时候出错,信息为:
error C2440: 'type cast' : cannot convert from '' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type请问,是不是哪里有问题了,还有其它方法吗??谢谢
在头文件声明:
public:
DWORD WINAPI ReadThreadProc(LPVOID lpvoid);//线程函数
VOID StartThread();//创建线程函数
在cpp文件我定义:
DWORD WINAPI MyClass::ReadThreadProc(LPVOID lpvoid)
{
..........
}
VOID MyClass::StartThread()
{
hThread = CreateThread(
NULL,
0, (LPTHREAD_START_ROUTINE)ReadThreadProc,
(LPVOID) &threadParam,
0,
&dwReadStatId);
......
}可是编译的时候出错,信息为:
error C2440: 'type cast' : cannot convert from '' to 'unsigned long (__stdcall *)(void *)'
None of the functions with this name in scope match the target type请问,是不是哪里有问题了,还有其它方法吗??谢谢
{
c->ProcessFunc();
}