trouble with _beginthread
-
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }
-
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }
NoName II wrote:
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member
- Made the CopyProcessTh as a static in the class which returns UINT from the function which is recommended to terminate the thread. OR 2) Seperate out the function from the class with following prototype
UINT CopyProcessTh(LPVOID pparam)
{
//Do your Stuff here.
return 0;
}Knock out 't' from can't, You can if you think you can :cool:
-
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }
There was a recent change to C++ that says you can't write
class_name::function_name
to get a pointer to the function, you have to write&class_name::function_name
--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member void CDlg::CopyProcessTh(void * p) { dlg=new CCopyInterface(this); if (m_copiedFile.GetLength()!=0) { dlg->CopyFileFunct(m_copiedFile,m_leftFolder); } }
See
void MyThread( LPVOID pv ); ... ... void CTest::RunThread() { _beginthread(MyThread,0,NULL); } void MyThread( LPVOID pv ) { CTest* m_Answer = (CTest*) pv; m_Answer->Modify(); } void CTest::Modify() { MessageBox("A"); }
_**
**_
whitesky
-
NoName II wrote:
_beginthread(CopyProcessTh, 0, NULL);//error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member
- Made the CopyProcessTh as a static in the class which returns UINT from the function which is recommended to terminate the thread. OR 2) Seperate out the function from the class with following prototype
UINT CopyProcessTh(LPVOID pparam)
{
//Do your Stuff here.
return 0;
}Knock out 't' from can't, You can if you think you can :cool:
-
See
void MyThread( LPVOID pv ); ... ... void CTest::RunThread() { _beginthread(MyThread,0,NULL); } void MyThread( LPVOID pv ) { CTest* m_Answer = (CTest*) pv; m_Answer->Modify(); } void CTest::Modify() { MessageBox("A"); }
_**
**_
whitesky
WhiteSky wrote:
_beginthread(MyThread,0,NULL);
You meant
_beginthread(MyThread,0,this);
no ?
Cédric Moonen Software developer
Charting control -
I can't made CopyProcessTh as a static cause it should operate with nonstatic members.. as for the 2nd...error C3867: 'CDlg::CopyProcessTh': function call missing argument list; use '&CDlg::CopyProcessTh' to create a pointer to member
NoName II wrote:
I can't made CopyProcessTh as a static cause it should operate with nonstatic members..
You can't pass a non-static member function to _beginthread. The reason is that static and non-static member functions don't have the same prototype. Non-static member functions have an implicit parameter that is passed: the 'this' parameter. Look at the post of WhyteSky for the 'workaround' to this problem.
Cédric Moonen Software developer
Charting control -
WhiteSky wrote:
_beginthread(MyThread,0,NULL);
You meant
_beginthread(MyThread,0,this);
no ?
Cédric Moonen Software developer
Charting controlyes:)_**
**_
whitesky