线程的创建,大家帮忙看看,是什么原因
BOOL bend=FALSE;
UINT CThreDlg::ThreadFunction(LPVOID pParam)
{
while(!bend){
Beep(100,100);
Sleep(1000);
}
return 0;
}
CWinThread *pThread;
HWND hWnd;
BOOL CThreDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
hWnd = GetSafeHwnd();
pThread = AfxBeginThread(ThreadFunction, hWnd);
pThread->m_bAutoDelete = FALSE;
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CThreDlg::OnCancel()
{
// TODO: Add your control notification handler code here
bend=TRUE;//改变变量,线程结束
WaitForSingleObject(pThread->m_hThread,INFINITE);//等待线程结束
delete pThread;//删除线程
}
编译不通过:
error C2665: 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
找半天找不出来,郁闷了...