MFC编程创建线程的问题,怎么声明线程函数为静态函数还是出错
在view类中函数声明:public:staticDWORDWINAPIThread1();在一个响应函数中创建:voidCChatSView::OnShowWindow...
在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 展开
函数声明:
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 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询