August 25th, 1999, 12:21 PM
I want to make a simple worker thread. This is my first time using threads
in an MFC app. But AfxBeginThread and _beginthread give compile errors.
'_beginthread': cannot convert parameter 1 from 'void(void*)' to 'void(__cdecl*)(void*)'
All the examples in the books look so simple, but I get compile errors.
I've tried all kinds of casts, but I do not think this is the problem.
Can anyone help?
I have VC++ 6.0 with no service packs.
void CLeftView::thread_OnUpdate(void *param)
{
int status;
CTreeCtrl &treeCtl = this->GetTreeCtrl();
CViewerDoc *pDoc = GetDocument();
void *db_handle_p;
cell_hdr_ptr_t cell_hdr_p;
(&treeCtl)->DeleteAllItems();
CCL_DBHandle_Get(&db_handle_p, pDoc->ccl_handle_p);
Db_Topcell_Get(&cell_hdr_p,db_handle_p);
// Now populate the tree view
{
CWaitCursor wait;
PopulateTreeView(&treeCtl, db_handle_p, cell_hdr_p, &status);
}
}
void CLeftView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// CWinThread *worker = AfxBeginThread(thread_OnUpdate, this);
_beginthread(thread_OnUpdate,0,this);
}
David Figueiredo
davidf@etec.com
in an MFC app. But AfxBeginThread and _beginthread give compile errors.
'_beginthread': cannot convert parameter 1 from 'void(void*)' to 'void(__cdecl*)(void*)'
All the examples in the books look so simple, but I get compile errors.
I've tried all kinds of casts, but I do not think this is the problem.
Can anyone help?
I have VC++ 6.0 with no service packs.
void CLeftView::thread_OnUpdate(void *param)
{
int status;
CTreeCtrl &treeCtl = this->GetTreeCtrl();
CViewerDoc *pDoc = GetDocument();
void *db_handle_p;
cell_hdr_ptr_t cell_hdr_p;
(&treeCtl)->DeleteAllItems();
CCL_DBHandle_Get(&db_handle_p, pDoc->ccl_handle_p);
Db_Topcell_Get(&cell_hdr_p,db_handle_p);
// Now populate the tree view
{
CWaitCursor wait;
PopulateTreeView(&treeCtl, db_handle_p, cell_hdr_p, &status);
}
}
void CLeftView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// CWinThread *worker = AfxBeginThread(thread_OnUpdate, this);
_beginthread(thread_OnUpdate,0,this);
}
David Figueiredo
davidf@etec.com