在MFC编程中创建线程,为什么线程函数设为静态的还是出错
恩,这是函数的声明,在view类中:public:staticDWORDWINAPIThread1();这个是创建函数的地方:voidCChatSView::OnShow...
恩,
这是函数的声明,在view类中:
public:
static DWORD WINAPI Thread1();
这个是创建函数的地方:
void CChatSView::OnShowWindow(BOOL bShow, UINT nStatus)
{
CView::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
this->m_hThread1=CreateThread(NULL,0,Thread1,NULL,0,NULL);
CloseHandle(this->m_hThread1);
}
这是报错...你们懂的:
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 展开
这是函数的声明,在view类中:
public:
static DWORD WINAPI Thread1();
这个是创建函数的地方:
void CChatSView::OnShowWindow(BOOL bShow, UINT nStatus)
{
CView::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
this->m_hThread1=CreateThread(NULL,0,Thread1,NULL,0,NULL);
CloseHandle(this->m_hThread1);
}
这是报错...你们懂的:
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 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询